From b9429e2133ffe2fd9f4025d4a1427890e8049661 Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Mon, 16 May 2022 14:03:01 +0530 Subject: [PATCH] fix current file --- apps/remix-ide/src/app/editor/editor.js | 1 + libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index 9fe194eeab..9bf7e3fec6 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -143,6 +143,7 @@ class Editor extends Plugin { this.on('fileManager', 'fileClosed', (name) => { if (name === this.currentFile) { this.currentFile = null + this.renderComponent() } }) this.on('theme', 'themeLoaded', (theme) => { diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index 7bc0efe7b0..0c718a8865 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -228,7 +228,7 @@ export const EditorUI = (props: EditorUIProps) => { useEffect(() => { - if (!editorRef.current) return + if (!editorRef.current || !props.currentFile) return currentFileRef.current = props.currentFile const file = editorModelsState[props.currentFile] editorRef.current.setModel(file.model)