@@ -62,16 +62,16 @@ export const CodeDisplay: FC<CodeDisplayProps> = ({ data, className, readOnly =
6262 } )
6363 }
6464
65- const highlightErrorLogs = ( ) => {
65+ const highlightErrorLogs = ( value : string ) => {
6666 const monacoInstance = monacoInstanceRef . current
67- if ( ! monacoInstance || ! editorRef . current || data === undefined ) {
67+ if ( ! monacoInstance || ! editorRef . current || value === undefined ) {
6868 return
6969 }
7070 const model = editorRef . current . getModel ( )
7171 if ( ! model ) return
7272
7373 const markers : monaco . editor . IMarkerData [ ] = [ ]
74- for ( const [ i , line ] of data . split ( '\n' ) . entries ( ) ) {
74+ for ( const [ i , line ] of value . split ( '\n' ) . entries ( ) ) {
7575 if (
7676 line . includes ( '"err"' ) ||
7777 line . toLowerCase ( ) . includes ( 'error' ) ||
@@ -97,7 +97,7 @@ export const CodeDisplay: FC<CodeDisplayProps> = ({ data, className, readOnly =
9797 ) => {
9898 editorRef . current = editor
9999 monacoInstanceRef . current = monacoInstance
100- highlightErrorLogs ( )
100+ highlightErrorLogs ( data )
101101 }
102102
103103 const handleEditorChange = ( value : string | undefined ) => {
@@ -131,7 +131,7 @@ export const CodeDisplay: FC<CodeDisplayProps> = ({ data, className, readOnly =
131131
132132 monacoInstance . editor . setModelMarkers ( model , 'yaml-validator' , markers )
133133
134- highlightErrorLogs ( )
134+ highlightErrorLogs ( value )
135135
136136 onChange ?.( value )
137137 }
0 commit comments