fix current file

pull/5370/head
Aniket-Engg 3 years ago
parent 0104292862
commit 3dcdfa13d5
  1. 1
      apps/remix-ide/src/app/editor/editor.js
  2. 2
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx

@ -143,6 +143,7 @@ class Editor extends Plugin {
this.on('fileManager', 'fileClosed', (name) => { this.on('fileManager', 'fileClosed', (name) => {
if (name === this.currentFile) { if (name === this.currentFile) {
this.currentFile = null this.currentFile = null
this.renderComponent()
} }
}) })
this.on('theme', 'themeLoaded', (theme) => { this.on('theme', 'themeLoaded', (theme) => {

@ -228,7 +228,7 @@ export const EditorUI = (props: EditorUIProps) => {
useEffect(() => { useEffect(() => {
if (!editorRef.current) return if (!editorRef.current || !props.currentFile) return
currentFileRef.current = props.currentFile currentFileRef.current = props.currentFile
const file = editorModelsState[props.currentFile] const file = editorModelsState[props.currentFile]
editorRef.current.setModel(file.model) editorRef.current.setModel(file.model)

Loading…
Cancel
Save