@lvce-editor/renderer-process 30.70.1 → 30.70.2

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.
@@ -1780,7 +1780,7 @@ const hydrate$4 = async () => {
1780
1780
  };
1781
1781
 
1782
1782
  // TODO needed?
1783
- const dispose$m = async () => {
1783
+ const dispose$n = async () => {
1784
1784
  const rpc = state$l.rpc;
1785
1785
  state$l.rpc = undefined;
1786
1786
  await rpc?.dispose();
@@ -1962,7 +1962,7 @@ const initializeLayout = async href => {
1962
1962
  }
1963
1963
  return true;
1964
1964
  };
1965
- const dispose$l = async () => {
1965
+ const dispose$m = async () => {
1966
1966
  state$k.stopObserving?.();
1967
1967
  state$k.stopObserving = undefined;
1968
1968
  const client = state$k.client;
@@ -4157,7 +4157,7 @@ const handleMessagePort$1 = async port => {
4157
4157
  }
4158
4158
  await rpc.invokeAndTransfer('DragAndDrop.handleMessagePort', port);
4159
4159
  };
4160
- const dispose$k = async () => {
4160
+ const dispose$l = async () => {
4161
4161
  const rpc = state$g.rpc;
4162
4162
  state$g.rpc = undefined;
4163
4163
  await rpc?.dispose();
@@ -4656,7 +4656,7 @@ const create$u = async ({
4656
4656
  // @ts-ignore
4657
4657
  return module.create(options);
4658
4658
  };
4659
- const dispose$j = id => {
4659
+ const dispose$k = id => {
4660
4660
  const worker = remove$3(id);
4661
4661
  if (worker) {
4662
4662
  remove$5(worker);
@@ -4774,7 +4774,7 @@ const applyPatch$1 = (element, patches, eventMap = {}, id = 0) => {
4774
4774
  }
4775
4775
  applyPatch$2(element, patches, eventMap, id);
4776
4776
  };
4777
- const dispose$i = root => {
4777
+ const dispose$j = root => {
4778
4778
  state$e.renderer?.dispose(root);
4779
4779
  };
4780
4780
 
@@ -4945,6 +4945,9 @@ const focusCommands = new Set(['Viewlet.focus', 'Viewlet.focusElementByName', 'V
4945
4945
  const take = (uid, transactionId, focusVersion = 0) => {
4946
4946
  const batch = pendingBatches.get(transactionId);
4947
4947
  if (!batch) {
4948
+ // An allocated transaction may have been discarded with its view. Late or
4949
+ // duplicate commits are harmless and must not affect a recreated root.
4950
+ if (transactionId > 0 && transactionId < state$a.nextTransactionId) return [];
4948
4951
  throw new Error(`pending viewlet command transaction not found: ${transactionId}`);
4949
4952
  }
4950
4953
  if (batch.uid !== uid) {
@@ -4968,6 +4971,11 @@ const take = (uid, transactionId, focusVersion = 0) => {
4968
4971
  }
4969
4972
  return commands;
4970
4973
  };
4974
+ const dispose$i = uid => {
4975
+ for (const [transactionId, batch] of pendingBatches) {
4976
+ if (batch.uid === uid) pendingBatches.delete(transactionId);
4977
+ }
4978
+ };
4971
4979
 
4972
4980
  const rememberFocus = rememberFocus$1;
4973
4981
 
@@ -9395,7 +9403,7 @@ const create$4 = (id, uid = id) => {
9395
9403
  if (!module) {
9396
9404
  throw new Error(`module not found: ${id}`);
9397
9405
  }
9398
- const existing = get$b(id);
9406
+ const existing = get$b(uid);
9399
9407
  if (existing?.state.$Viewlet.isConnected) {
9400
9408
  existing.state.$Viewlet.remove();
9401
9409
  }
@@ -9425,6 +9433,7 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcI
9425
9433
  $Viewlet: document.createElement('div')
9426
9434
  };
9427
9435
  set$a(instanceState.$Viewlet, uid);
9436
+ if (existing) dispose$i(uid);
9428
9437
  registerView(uid, directEventRpcId);
9429
9438
  set$c(uid, {
9430
9439
  factory: module,
@@ -9919,6 +9928,7 @@ const dispose$4 = id => {
9919
9928
  number(id);
9920
9929
  restoreComponentDom(id);
9921
9930
  unregisterView(id);
9931
+ dispose$i(id);
9922
9932
  const instance = get$b(id);
9923
9933
  if (!instance) {
9924
9934
  warn(`viewlet instance ${id} not found and cannot be disposed`);
@@ -9927,7 +9937,7 @@ const dispose$4 = id => {
9927
9937
  if (instance.factory.dispose) {
9928
9938
  instance.factory.dispose(instance.state);
9929
9939
  }
9930
- dispose$i(instance.state.$Viewlet);
9940
+ dispose$j(instance.state.$Viewlet);
9931
9941
  if (instance.state.$Viewlet?.isConnected) {
9932
9942
  instance.state.$Viewlet.remove();
9933
9943
  }
@@ -10262,9 +10272,9 @@ const restart = async () => {
10262
10272
  const snapshot = await invoke$1('Reload.prepareHotReload');
10263
10273
  set$9(snapshot);
10264
10274
  await invoke$1('Reload.retire');
10265
- await dispose$l();
10266
10275
  await dispose$m();
10267
- await dispose$k();
10276
+ await dispose$n();
10277
+ await dispose$l();
10268
10278
  terminateAll();
10269
10279
  clear$2();
10270
10280
  clear$4();
@@ -12301,7 +12311,7 @@ const commandMap = {
12301
12311
  'HotReload.request': request,
12302
12312
  'InitData.getInitData': getInitData,
12303
12313
  'IpcParent.create': create$u,
12304
- 'IpcParent.dispose': dispose$j,
12314
+ 'IpcParent.dispose': dispose$k,
12305
12315
  'KeyBindings.setIdentifiers': setIdentifiers,
12306
12316
  'Layout.getBounds': getBounds,
12307
12317
  'Location.getHref': getHref,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.70.1",
3
+ "version": "30.70.2",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"