@liveblocks/core 1.2.2-test1 → 1.2.2-test3

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.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/version.ts
2
2
  var PKG_NAME = "@liveblocks/core";
3
- var PKG_VERSION = "1.2.2-test1";
3
+ var PKG_VERSION = "1.2.2-test3";
4
4
  var PKG_FORMAT = "esm";
5
5
 
6
6
  // src/dupe-detection.ts
@@ -2069,6 +2069,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2069
2069
  this._items = [];
2070
2070
  this._implicitlyDeletedItems = /* @__PURE__ */ new WeakSet();
2071
2071
  this._unacknowledgedDeletedIds = /* @__PURE__ */ new Set();
2072
+ this._unacknowledgedSets = /* @__PURE__ */ new Map();
2072
2073
  let position = void 0;
2073
2074
  for (const item of items) {
2074
2075
  const newPosition = makePosition(position);
@@ -2211,6 +2212,14 @@ var LiveList = class _LiveList extends AbstractCrdt {
2211
2212
  if (deletedDelta) {
2212
2213
  delta.push(deletedDelta);
2213
2214
  }
2215
+ const unacknowledgedOpId = this._unacknowledgedSets.get(op.parentKey);
2216
+ if (unacknowledgedOpId !== void 0) {
2217
+ if (unacknowledgedOpId !== op.opId) {
2218
+ return delta.length === 0 ? { modified: false } : { modified: makeUpdate(this, delta), reverse: [] };
2219
+ } else {
2220
+ this._unacknowledgedSets.delete(op.parentKey);
2221
+ }
2222
+ }
2214
2223
  if (this._unacknowledgedDeletedIds.has(op.id)) {
2215
2224
  this._unacknowledgedDeletedIds.delete(op.id);
2216
2225
  return delta.length === 0 ? { modified: false } : { modified: makeUpdate(this, delta), reverse: [] };
@@ -2397,6 +2406,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2397
2406
  if (this._pool?.getNode(id) !== void 0) {
2398
2407
  return { modified: false };
2399
2408
  }
2409
+ this._unacknowledgedSets.set(key, nn(op.opId));
2400
2410
  const indexOfItemWithSameKey = this._indexOfPosition(key);
2401
2411
  child._attach(id, nn(this._pool));
2402
2412
  child._setParentLink(this, key);
@@ -2836,6 +2846,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2836
2846
  value._toOps(this._id, position, this._pool),
2837
2847
  existingId
2838
2848
  );
2849
+ this._unacknowledgedSets.set(position, nn(ops[0].opId));
2839
2850
  const reverseOps = HACK_addIntentAndDeletedIdToOperation(
2840
2851
  existingItem._toOps(this._id, position, void 0),
2841
2852
  id