Skip to content

Commit 6345b0a

Browse files
committed
Fix persistent error markers when switching projects
1 parent d7f9396 commit 6345b0a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/components/CodeEditor/CodeEditor.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,17 @@ function CodeEditor({
201201
}
202202
}, [theme]);
203203

204+
// Clear markers when switching projects or languages
205+
useEffect(() => {
206+
if (monacoRef.current && editorRef.current) {
207+
const model = editorRef.current.getModel();
208+
if (model) {
209+
// Clear all markers for this model
210+
monacoRef.current.editor.setModelMarkers(model, 'owner', []);
211+
}
212+
}
213+
}, [value, language]);
214+
204215
// Cleanup on unmount
205216
useEffect(() => {
206217
return () => {

0 commit comments

Comments
 (0)