Copilot commented on code in PR #3070:
URL: https://github.com/apache/apisix-dashboard/pull/3070#discussion_r2098145177


##########
src/components/form/Editor.tsx:
##########
@@ -111,7 +115,14 @@ export const FormItemEditor = <T extends FieldValues>(
       trailingCommas: 'error',
       enableSchemaRequest: false,
     });
-  }, [customSchema, monaco, isLoading]);
+    // when markers change, show error
+    monaco.editor.onDidChangeMarkers(([uri]) => {
+      showErrOnMarkers(uri);
+    });
+
+    setLoading(false);

Review Comment:
   Consider assigning the onDidChangeMarkers subscription to a variable and 
disposing it in the cleanup function of the useEffect hook, to prevent 
potential memory leaks when the component unmounts or the effect re-runs.
   ```suggestion
       const markerSubscription = monaco.editor.onDidChangeMarkers(([uri]) => {
         showErrOnMarkers(uri);
       });
   
       setLoading(false);
   
       return () => {
         markerSubscription.dispose();
       };
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to