@lvce-editor/editor-worker 19.26.2 → 19.26.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11571,6 +11571,9 @@ const getProblems = async () => {
11571
11571
  const diagnostics = keys.flatMap(key => {
11572
11572
  const numericKey = Number(key);
11573
11573
  const editor = get$7(numericKey);
11574
+ if (!editor?.newState) {
11575
+ return [];
11576
+ }
11574
11577
  return editor.newState.diagnostics;
11575
11578
  });
11576
11579
  return diagnostics;
@@ -13338,6 +13341,15 @@ const updateDiagnostics = async editor => {
13338
13341
  }
13339
13342
  };
13340
13343
 
13344
+ const editorDiagnosticEffect = {
13345
+ // TODO set effects delay / diagnostic delay
13346
+ apply(editor) {
13347
+ return updateDiagnostics(editor);
13348
+ },
13349
+ // TODO avoid slow comparison
13350
+ isActive: (oldEditor, newEditor) => newEditor.diagnosticsEnabled && JSON.stringify(oldEditor.lines) !== JSON.stringify(newEditor.lines)
13351
+ };
13352
+
13341
13353
  const queues = [];
13342
13354
 
13343
13355
  // TODO wrap commands globally, not per editor
@@ -13362,7 +13374,15 @@ const wrapCommand = fn => async (uid, ...args) => {
13362
13374
  }
13363
13375
  const newEditorWithDerivedState = await updateDerivedState(state, newEditor);
13364
13376
  set$9(uid, state, newEditorWithDerivedState);
13365
- return newEditorWithDerivedState;
13377
+ if (!editorDiagnosticEffect.isActive(state, newEditorWithDerivedState)) {
13378
+ return newEditorWithDerivedState;
13379
+ }
13380
+ const newEditorWithDiagnostics = await editorDiagnosticEffect.apply(newEditorWithDerivedState);
13381
+ if (!get$7(uid)) {
13382
+ return newEditorWithDiagnostics;
13383
+ }
13384
+ set$9(uid, state, newEditorWithDiagnostics);
13385
+ return newEditorWithDiagnostics;
13366
13386
  } finally {
13367
13387
  resolve();
13368
13388
  if (queues[uid] === next) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.26.2",
3
+ "version": "19.26.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"