Skip to content

Commit

Permalink
Merge pull request #49 from CodinGame/fix-model-change
Browse files Browse the repository at this point in the history
Fix model update
  • Loading branch information
CGNonofr authored Apr 23, 2024
2 parents 1b0aeba + f6d023c commit d1a4104
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/MonacoEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,11 @@ function MonacoEditor ({
if (fileUri != null) {
const uri = monaco.Uri.parse(fileUri)

const fileDisposable = registerFile(new RegisteredMemoryFile(uri, value!))
disposableStore.add(registerFile(new RegisteredMemoryFile(uri, value!)))

const modelIRefPromise = createModelReference(uri)
disposableStore.add({
dispose () {
fileDisposable.dispose()
void modelIRefPromise.then(modelIRef => modelIRef.dispose(), console.error)
}
})
Expand Down Expand Up @@ -249,7 +248,6 @@ function MonacoEditor ({
lastSaveViewState(editorRef.current, model)
}
disposableStore.dispose()
modelRef.current = undefined
}
}
const disposePromise = updateModel()
Expand Down

0 comments on commit d1a4104

Please sign in to comment.