diff --git a/client/src/components/level.tsx b/client/src/components/level.tsx index 406f92f..97cf73d 100644 --- a/client/src/components/level.tsx +++ b/client/src/components/level.tsx @@ -48,10 +48,10 @@ function Level() { const params = useParams() const levelId = parseInt(params.levelId) const worldId = params.worldId - useLoadWorldFiles(worldId) + // useLoadWorldFiles(worldId) return - {levelId == 0 ? : } + {levelId == 0 ? : } } @@ -553,8 +553,8 @@ function useLevelEditor(codeviewRef, initialCode, initialSelections, onDidChange }, []) const {leanClient, leanClientStarted} = useLeanClient(gameId) - - const uri = monaco.Uri.parse(`file:///${worldId}/${levelId}`) + const uriStr = `file:///${worldId}/${levelId}` + const uri = monaco.Uri.parse(uriStr) // Create model when level changes useEffect(() => { @@ -572,6 +572,10 @@ function useLevelEditor(codeviewRef, initialCode, initialSelections, onDidChange // BUG: Somehow I get an `invalid arguments` bug here // editor.setSelections(initialSelections) } + + return () => { + editorConnection.api.sendClientNotification(uriStr, "textDocument/didClose", {textDocument: {uri: uriStr}}) + model.dispose(); } } }, [editor, levelId, connection, leanClientStarted])