@lvce-editor/ports-view 0.13.0 → 0.13.1

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.
@@ -1206,6 +1206,7 @@ const toCommandId = key => {
1206
1206
  };
1207
1207
  const create$1 = () => {
1208
1208
  const commandQueues = new Map();
1209
+ const instanceIds = Object.create(null);
1209
1210
  const generations = Object.create(null);
1210
1211
  const states = Object.create(null);
1211
1212
  const commandMapRef = Object.create(null);
@@ -1320,6 +1321,9 @@ const create$1 = () => {
1320
1321
  },
1321
1322
  set(uid, oldState, newState, scheduledState) {
1322
1323
  const current = states[uid];
1324
+ if (!current) {
1325
+ instanceIds[uid] = (instanceIds[uid] || 0) + 1;
1326
+ }
1323
1327
  if (!current || oldState === newState && newState !== current.newState) {
1324
1328
  generations[uid] = getGeneration(uid) + 1;
1325
1329
  }
@@ -1413,8 +1417,9 @@ const create$1 = () => {
1413
1417
  },
1414
1418
  wrapSerialAsyncCommand(fn) {
1415
1419
  const wrapped = async (uid, ...args) => {
1420
+ const instanceId = instanceIds[uid];
1416
1421
  await enqueueCommand(uid, async () => {
1417
- if (!states[uid]) {
1422
+ if (!states[uid] || instanceIds[uid] !== instanceId) {
1418
1423
  return;
1419
1424
  }
1420
1425
  const generation = getGeneration(uid);
@@ -1426,8 +1431,9 @@ const create$1 = () => {
1426
1431
  },
1427
1432
  wrapSerialCommand(fn) {
1428
1433
  const wrapped = async (uid, ...args) => {
1434
+ const instanceId = instanceIds[uid];
1429
1435
  await enqueueCommand(uid, async () => {
1430
- if (!states[uid]) {
1436
+ if (!states[uid] || instanceIds[uid] !== instanceId) {
1431
1437
  return;
1432
1438
  }
1433
1439
  const generation = getGeneration(uid);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/ports-view",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Ports View Worker",
5
5
  "repository": {
6
6
  "type": "git",