mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 09:36:27 +00:00
editor/sagas: fix error creating model on hot reload
This commit is contained in:
+12
-5
@@ -95,11 +95,18 @@ function* handleEditorOpenFile(
|
||||
|
||||
defined(didRead);
|
||||
|
||||
const model = monaco.editor.createModel(
|
||||
didRead.contents,
|
||||
pybricksMicroPythonId,
|
||||
monaco.Uri.from({ scheme: 'pybricksCode', path: action.fileName }),
|
||||
);
|
||||
const modelUri = monaco.Uri.from({
|
||||
scheme: 'pybricksCode',
|
||||
path: action.fileName,
|
||||
});
|
||||
|
||||
const model =
|
||||
monaco.editor.getModel(modelUri) ??
|
||||
monaco.editor.createModel(
|
||||
didRead.contents,
|
||||
pybricksMicroPythonId,
|
||||
modelUri,
|
||||
);
|
||||
defer.push(() => model.dispose());
|
||||
|
||||
// TODO: get viewState from fileStorage
|
||||
|
||||
Reference in New Issue
Block a user