Skip to content

Commit 3aa4383

Browse files
committed
Fix editor common errors
1 parent 3e1ef52 commit 3aa4383

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

packages/app/src/app/components/CodeEditor/Monaco/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,11 +1065,15 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
10651065

10661066
this.lint = debounce(this.lint, 400);
10671067

1068-
this.lint(
1069-
this.getCode(),
1070-
this.currentModule.title,
1071-
this.editor.getModel().getVersionId()
1072-
);
1068+
requestAnimationFrame(() => {
1069+
if (this.editor.getModel()) {
1070+
this.lint(
1071+
this.getCode(),
1072+
this.currentModule.title,
1073+
this.editor.getModel().getVersionId()
1074+
);
1075+
}
1076+
});
10731077
}
10741078
};
10751079

@@ -1164,9 +1168,6 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
11641168
// the old extraLib definition and defining a new one.
11651169
modelCache[id].lib.dispose();
11661170
modelCache[id].lib = this.addLib(currentModule.code || '', path);
1167-
1168-
// Reset changes
1169-
this.changes = { code: '', changes: [] };
11701171
}
11711172
}
11721173

packages/app/src/app/components/CodeEditor/VSCode/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
12791279
this.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
12801280
validate: true,
12811281
schemas: [
1282-
...this.monaco.languages.json.jsonDefaults._diagnosticsOptions,
1282+
...this.monaco.languages.json.jsonDefaults._diagnosticsOptions.schemas,
12831283
...monacoSchemas,
12841284
],
12851285
});

0 commit comments

Comments
 (0)