houdini-svelte 2.2.0-next.3 → 2.2.0-next.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.
@@ -87144,20 +87144,21 @@ var CacheInternal = class {
87144
87144
  } else if (Array.isArray(value) && // make typescript happy
87145
87145
  (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
87146
87146
  let oldIDs = [...previousValue || []];
87147
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
87148
- if (!id) {
87149
- return "";
87150
- }
87151
- const { value: cursorField } = this.storage.get(id, "cursor");
87152
- if (cursorField) {
87153
- return "";
87154
- }
87155
- const { value: node } = this.storage.get(id, "node");
87156
- if (!node) {
87157
- return "";
87158
- }
87159
- return node;
87160
- });
87147
+ if (updates?.includes("append") || updates?.includes("prepend")) {
87148
+ oldIDs = oldIDs.filter((id) => {
87149
+ for (const layer2 of this.storage.data) {
87150
+ for (const operation of Object.values(layer2.operations)) {
87151
+ if (operation.fields?.[key])
87152
+ for (const listOperation of operation.fields[key]) {
87153
+ if ("id" in listOperation && listOperation.id === id) {
87154
+ return false;
87155
+ }
87156
+ }
87157
+ }
87158
+ }
87159
+ return true;
87160
+ });
87161
+ }
87161
87162
  let linkedIDs = [];
87162
87163
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
87163
87164
  value,
@@ -87176,39 +87177,45 @@ var CacheInternal = class {
87176
87177
  layer.writeLink(parent2, key, linkedIDs);
87177
87178
  };
87178
87179
  if (applyUpdates && updates) {
87179
- if (key === "edges") {
87180
- const newNodeIDs = [];
87181
- for (const id of newIDs) {
87180
+ const filterIDs = (keep, insert) => {
87181
+ const existingIDs = /* @__PURE__ */ new Set();
87182
+ for (const id of keep) {
87182
87183
  if (!id) {
87183
87184
  continue;
87184
87185
  }
87185
87186
  const { value: node } = this.storage.get(id, "node");
87186
- if (typeof node !== "string") {
87187
+ if (!node) {
87187
87188
  continue;
87188
87189
  }
87189
- if (!node || !this.storage.get(node, "__typename")) {
87190
+ const nodeID = this.storage.get(node, "id");
87191
+ if (!nodeID) {
87190
87192
  continue;
87191
87193
  }
87192
- newNodeIDs.push(node);
87194
+ existingIDs.add(nodeID.value);
87193
87195
  }
87194
- oldIDs = oldIDs.filter((id) => {
87196
+ return insert.filter((id) => {
87195
87197
  if (!id) {
87196
87198
  return true;
87197
87199
  }
87198
- const { value: value2 } = this.storage.get(id, "node");
87199
- const node = value2;
87200
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
87201
- return false;
87200
+ const { value: node } = this.storage.get(id, "node");
87201
+ if (!node) {
87202
+ return true;
87202
87203
  }
87203
- return true;
87204
+ const nodeID = this.storage.get(node, "id");
87205
+ if (!nodeID) {
87206
+ return true;
87207
+ }
87208
+ return !existingIDs.has(nodeID.value);
87204
87209
  });
87205
- }
87210
+ };
87206
87211
  for (const update of applyUpdates) {
87207
87212
  if (update !== "replace" && !updates.includes(update)) {
87208
87213
  continue;
87209
87214
  }
87210
87215
  if (update === "prepend") {
87211
- linkedIDs = newIDs.concat(oldIDs);
87216
+ linkedIDs = newIDs.concat(
87217
+ filterIDs(newIDs, oldIDs)
87218
+ );
87212
87219
  if (layer?.optimistic) {
87213
87220
  action = () => {
87214
87221
  for (const id of newIDs) {
@@ -87219,7 +87226,7 @@ var CacheInternal = class {
87219
87226
  };
87220
87227
  }
87221
87228
  } else if (update === "append") {
87222
- linkedIDs = oldIDs.concat(newIDs);
87229
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
87223
87230
  if (layer?.optimistic) {
87224
87231
  action = () => {
87225
87232
  for (const id of newIDs) {
@@ -158920,20 +158927,21 @@ var CacheInternal2 = class {
158920
158927
  } else if (Array.isArray(value) && // make typescript happy
158921
158928
  (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
158922
158929
  let oldIDs = [...previousValue || []];
158923
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
158924
- if (!id) {
158925
- return "";
158926
- }
158927
- const { value: cursorField } = this.storage.get(id, "cursor");
158928
- if (cursorField) {
158929
- return "";
158930
- }
158931
- const { value: node } = this.storage.get(id, "node");
158932
- if (!node) {
158933
- return "";
158934
- }
158935
- return node;
158936
- });
158930
+ if (updates?.includes("append") || updates?.includes("prepend")) {
158931
+ oldIDs = oldIDs.filter((id) => {
158932
+ for (const layer2 of this.storage.data) {
158933
+ for (const operation of Object.values(layer2.operations)) {
158934
+ if (operation.fields?.[key])
158935
+ for (const listOperation of operation.fields[key]) {
158936
+ if ("id" in listOperation && listOperation.id === id) {
158937
+ return false;
158938
+ }
158939
+ }
158940
+ }
158941
+ }
158942
+ return true;
158943
+ });
158944
+ }
158937
158945
  let linkedIDs = [];
158938
158946
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
158939
158947
  value,
@@ -158952,39 +158960,45 @@ var CacheInternal2 = class {
158952
158960
  layer.writeLink(parent2, key, linkedIDs);
158953
158961
  };
158954
158962
  if (applyUpdates && updates) {
158955
- if (key === "edges") {
158956
- const newNodeIDs = [];
158957
- for (const id of newIDs) {
158963
+ const filterIDs = (keep, insert) => {
158964
+ const existingIDs = /* @__PURE__ */ new Set();
158965
+ for (const id of keep) {
158958
158966
  if (!id) {
158959
158967
  continue;
158960
158968
  }
158961
158969
  const { value: node } = this.storage.get(id, "node");
158962
- if (typeof node !== "string") {
158970
+ if (!node) {
158963
158971
  continue;
158964
158972
  }
158965
- if (!node || !this.storage.get(node, "__typename")) {
158973
+ const nodeID = this.storage.get(node, "id");
158974
+ if (!nodeID) {
158966
158975
  continue;
158967
158976
  }
158968
- newNodeIDs.push(node);
158977
+ existingIDs.add(nodeID.value);
158969
158978
  }
158970
- oldIDs = oldIDs.filter((id) => {
158979
+ return insert.filter((id) => {
158971
158980
  if (!id) {
158972
158981
  return true;
158973
158982
  }
158974
- const { value: value2 } = this.storage.get(id, "node");
158975
- const node = value2;
158976
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
158977
- return false;
158983
+ const { value: node } = this.storage.get(id, "node");
158984
+ if (!node) {
158985
+ return true;
158978
158986
  }
158979
- return true;
158987
+ const nodeID = this.storage.get(node, "id");
158988
+ if (!nodeID) {
158989
+ return true;
158990
+ }
158991
+ return !existingIDs.has(nodeID.value);
158980
158992
  });
158981
- }
158993
+ };
158982
158994
  for (const update of applyUpdates) {
158983
158995
  if (update !== "replace" && !updates.includes(update)) {
158984
158996
  continue;
158985
158997
  }
158986
158998
  if (update === "prepend") {
158987
- linkedIDs = newIDs.concat(oldIDs);
158999
+ linkedIDs = newIDs.concat(
159000
+ filterIDs(newIDs, oldIDs)
159001
+ );
158988
159002
  if (layer?.optimistic) {
158989
159003
  action = () => {
158990
159004
  for (const id of newIDs) {
@@ -158995,7 +159009,7 @@ var CacheInternal2 = class {
158995
159009
  };
158996
159010
  }
158997
159011
  } else if (update === "append") {
158998
- linkedIDs = oldIDs.concat(newIDs);
159012
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
158999
159013
  if (layer?.optimistic) {
159000
159014
  action = () => {
159001
159015
  for (const id of newIDs) {
@@ -87140,20 +87140,21 @@ var CacheInternal = class {
87140
87140
  } else if (Array.isArray(value) && // make typescript happy
87141
87141
  (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
87142
87142
  let oldIDs = [...previousValue || []];
87143
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
87144
- if (!id) {
87145
- return "";
87146
- }
87147
- const { value: cursorField } = this.storage.get(id, "cursor");
87148
- if (cursorField) {
87149
- return "";
87150
- }
87151
- const { value: node } = this.storage.get(id, "node");
87152
- if (!node) {
87153
- return "";
87154
- }
87155
- return node;
87156
- });
87143
+ if (updates?.includes("append") || updates?.includes("prepend")) {
87144
+ oldIDs = oldIDs.filter((id) => {
87145
+ for (const layer2 of this.storage.data) {
87146
+ for (const operation of Object.values(layer2.operations)) {
87147
+ if (operation.fields?.[key])
87148
+ for (const listOperation of operation.fields[key]) {
87149
+ if ("id" in listOperation && listOperation.id === id) {
87150
+ return false;
87151
+ }
87152
+ }
87153
+ }
87154
+ }
87155
+ return true;
87156
+ });
87157
+ }
87157
87158
  let linkedIDs = [];
87158
87159
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
87159
87160
  value,
@@ -87172,39 +87173,45 @@ var CacheInternal = class {
87172
87173
  layer.writeLink(parent2, key, linkedIDs);
87173
87174
  };
87174
87175
  if (applyUpdates && updates) {
87175
- if (key === "edges") {
87176
- const newNodeIDs = [];
87177
- for (const id of newIDs) {
87176
+ const filterIDs = (keep, insert) => {
87177
+ const existingIDs = /* @__PURE__ */ new Set();
87178
+ for (const id of keep) {
87178
87179
  if (!id) {
87179
87180
  continue;
87180
87181
  }
87181
87182
  const { value: node } = this.storage.get(id, "node");
87182
- if (typeof node !== "string") {
87183
+ if (!node) {
87183
87184
  continue;
87184
87185
  }
87185
- if (!node || !this.storage.get(node, "__typename")) {
87186
+ const nodeID = this.storage.get(node, "id");
87187
+ if (!nodeID) {
87186
87188
  continue;
87187
87189
  }
87188
- newNodeIDs.push(node);
87190
+ existingIDs.add(nodeID.value);
87189
87191
  }
87190
- oldIDs = oldIDs.filter((id) => {
87192
+ return insert.filter((id) => {
87191
87193
  if (!id) {
87192
87194
  return true;
87193
87195
  }
87194
- const { value: value2 } = this.storage.get(id, "node");
87195
- const node = value2;
87196
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
87197
- return false;
87196
+ const { value: node } = this.storage.get(id, "node");
87197
+ if (!node) {
87198
+ return true;
87198
87199
  }
87199
- return true;
87200
+ const nodeID = this.storage.get(node, "id");
87201
+ if (!nodeID) {
87202
+ return true;
87203
+ }
87204
+ return !existingIDs.has(nodeID.value);
87200
87205
  });
87201
- }
87206
+ };
87202
87207
  for (const update of applyUpdates) {
87203
87208
  if (update !== "replace" && !updates.includes(update)) {
87204
87209
  continue;
87205
87210
  }
87206
87211
  if (update === "prepend") {
87207
- linkedIDs = newIDs.concat(oldIDs);
87212
+ linkedIDs = newIDs.concat(
87213
+ filterIDs(newIDs, oldIDs)
87214
+ );
87208
87215
  if (layer?.optimistic) {
87209
87216
  action = () => {
87210
87217
  for (const id of newIDs) {
@@ -87215,7 +87222,7 @@ var CacheInternal = class {
87215
87222
  };
87216
87223
  }
87217
87224
  } else if (update === "append") {
87218
- linkedIDs = oldIDs.concat(newIDs);
87225
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
87219
87226
  if (layer?.optimistic) {
87220
87227
  action = () => {
87221
87228
  for (const id of newIDs) {
@@ -158915,20 +158922,21 @@ var CacheInternal2 = class {
158915
158922
  } else if (Array.isArray(value) && // make typescript happy
158916
158923
  (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
158917
158924
  let oldIDs = [...previousValue || []];
158918
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
158919
- if (!id) {
158920
- return "";
158921
- }
158922
- const { value: cursorField } = this.storage.get(id, "cursor");
158923
- if (cursorField) {
158924
- return "";
158925
- }
158926
- const { value: node } = this.storage.get(id, "node");
158927
- if (!node) {
158928
- return "";
158929
- }
158930
- return node;
158931
- });
158925
+ if (updates?.includes("append") || updates?.includes("prepend")) {
158926
+ oldIDs = oldIDs.filter((id) => {
158927
+ for (const layer2 of this.storage.data) {
158928
+ for (const operation of Object.values(layer2.operations)) {
158929
+ if (operation.fields?.[key])
158930
+ for (const listOperation of operation.fields[key]) {
158931
+ if ("id" in listOperation && listOperation.id === id) {
158932
+ return false;
158933
+ }
158934
+ }
158935
+ }
158936
+ }
158937
+ return true;
158938
+ });
158939
+ }
158932
158940
  let linkedIDs = [];
158933
158941
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
158934
158942
  value,
@@ -158947,39 +158955,45 @@ var CacheInternal2 = class {
158947
158955
  layer.writeLink(parent2, key, linkedIDs);
158948
158956
  };
158949
158957
  if (applyUpdates && updates) {
158950
- if (key === "edges") {
158951
- const newNodeIDs = [];
158952
- for (const id of newIDs) {
158958
+ const filterIDs = (keep, insert) => {
158959
+ const existingIDs = /* @__PURE__ */ new Set();
158960
+ for (const id of keep) {
158953
158961
  if (!id) {
158954
158962
  continue;
158955
158963
  }
158956
158964
  const { value: node } = this.storage.get(id, "node");
158957
- if (typeof node !== "string") {
158965
+ if (!node) {
158958
158966
  continue;
158959
158967
  }
158960
- if (!node || !this.storage.get(node, "__typename")) {
158968
+ const nodeID = this.storage.get(node, "id");
158969
+ if (!nodeID) {
158961
158970
  continue;
158962
158971
  }
158963
- newNodeIDs.push(node);
158972
+ existingIDs.add(nodeID.value);
158964
158973
  }
158965
- oldIDs = oldIDs.filter((id) => {
158974
+ return insert.filter((id) => {
158966
158975
  if (!id) {
158967
158976
  return true;
158968
158977
  }
158969
- const { value: value2 } = this.storage.get(id, "node");
158970
- const node = value2;
158971
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
158972
- return false;
158978
+ const { value: node } = this.storage.get(id, "node");
158979
+ if (!node) {
158980
+ return true;
158973
158981
  }
158974
- return true;
158982
+ const nodeID = this.storage.get(node, "id");
158983
+ if (!nodeID) {
158984
+ return true;
158985
+ }
158986
+ return !existingIDs.has(nodeID.value);
158975
158987
  });
158976
- }
158988
+ };
158977
158989
  for (const update of applyUpdates) {
158978
158990
  if (update !== "replace" && !updates.includes(update)) {
158979
158991
  continue;
158980
158992
  }
158981
158993
  if (update === "prepend") {
158982
- linkedIDs = newIDs.concat(oldIDs);
158994
+ linkedIDs = newIDs.concat(
158995
+ filterIDs(newIDs, oldIDs)
158996
+ );
158983
158997
  if (layer?.optimistic) {
158984
158998
  action = () => {
158985
158999
  for (const id of newIDs) {
@@ -158990,7 +159004,7 @@ var CacheInternal2 = class {
158990
159004
  };
158991
159005
  }
158992
159006
  } else if (update === "append") {
158993
- linkedIDs = oldIDs.concat(newIDs);
159007
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
158994
159008
  if (layer?.optimistic) {
158995
159009
  action = () => {
158996
159010
  for (const id of newIDs) {
@@ -90494,20 +90494,21 @@ var CacheInternal = class {
90494
90494
  } else if (Array.isArray(value) && // make typescript happy
90495
90495
  (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
90496
90496
  let oldIDs = [...previousValue || []];
90497
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
90498
- if (!id) {
90499
- return "";
90500
- }
90501
- const { value: cursorField } = this.storage.get(id, "cursor");
90502
- if (cursorField) {
90503
- return "";
90504
- }
90505
- const { value: node } = this.storage.get(id, "node");
90506
- if (!node) {
90507
- return "";
90508
- }
90509
- return node;
90510
- });
90497
+ if (updates?.includes("append") || updates?.includes("prepend")) {
90498
+ oldIDs = oldIDs.filter((id) => {
90499
+ for (const layer2 of this.storage.data) {
90500
+ for (const operation of Object.values(layer2.operations)) {
90501
+ if (operation.fields?.[key])
90502
+ for (const listOperation of operation.fields[key]) {
90503
+ if ("id" in listOperation && listOperation.id === id) {
90504
+ return false;
90505
+ }
90506
+ }
90507
+ }
90508
+ }
90509
+ return true;
90510
+ });
90511
+ }
90511
90512
  let linkedIDs = [];
90512
90513
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
90513
90514
  value,
@@ -90526,39 +90527,45 @@ var CacheInternal = class {
90526
90527
  layer.writeLink(parent2, key, linkedIDs);
90527
90528
  };
90528
90529
  if (applyUpdates && updates) {
90529
- if (key === "edges") {
90530
- const newNodeIDs = [];
90531
- for (const id of newIDs) {
90530
+ const filterIDs = (keep, insert) => {
90531
+ const existingIDs = /* @__PURE__ */ new Set();
90532
+ for (const id of keep) {
90532
90533
  if (!id) {
90533
90534
  continue;
90534
90535
  }
90535
90536
  const { value: node } = this.storage.get(id, "node");
90536
- if (typeof node !== "string") {
90537
+ if (!node) {
90537
90538
  continue;
90538
90539
  }
90539
- if (!node || !this.storage.get(node, "__typename")) {
90540
+ const nodeID = this.storage.get(node, "id");
90541
+ if (!nodeID) {
90540
90542
  continue;
90541
90543
  }
90542
- newNodeIDs.push(node);
90544
+ existingIDs.add(nodeID.value);
90543
90545
  }
90544
- oldIDs = oldIDs.filter((id) => {
90546
+ return insert.filter((id) => {
90545
90547
  if (!id) {
90546
90548
  return true;
90547
90549
  }
90548
- const { value: value2 } = this.storage.get(id, "node");
90549
- const node = value2;
90550
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
90551
- return false;
90550
+ const { value: node } = this.storage.get(id, "node");
90551
+ if (!node) {
90552
+ return true;
90552
90553
  }
90553
- return true;
90554
+ const nodeID = this.storage.get(node, "id");
90555
+ if (!nodeID) {
90556
+ return true;
90557
+ }
90558
+ return !existingIDs.has(nodeID.value);
90554
90559
  });
90555
- }
90560
+ };
90556
90561
  for (const update of applyUpdates) {
90557
90562
  if (update !== "replace" && !updates.includes(update)) {
90558
90563
  continue;
90559
90564
  }
90560
90565
  if (update === "prepend") {
90561
- linkedIDs = newIDs.concat(oldIDs);
90566
+ linkedIDs = newIDs.concat(
90567
+ filterIDs(newIDs, oldIDs)
90568
+ );
90562
90569
  if (layer?.optimistic) {
90563
90570
  action = () => {
90564
90571
  for (const id of newIDs) {
@@ -90569,7 +90576,7 @@ var CacheInternal = class {
90569
90576
  };
90570
90577
  }
90571
90578
  } else if (update === "append") {
90572
- linkedIDs = oldIDs.concat(newIDs);
90579
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
90573
90580
  if (layer?.optimistic) {
90574
90581
  action = () => {
90575
90582
  for (const id of newIDs) {
@@ -163269,20 +163276,21 @@ var CacheInternal2 = class {
163269
163276
  } else if (Array.isArray(value) && // make typescript happy
163270
163277
  (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
163271
163278
  let oldIDs = [...previousValue || []];
163272
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
163273
- if (!id) {
163274
- return "";
163275
- }
163276
- const { value: cursorField } = this.storage.get(id, "cursor");
163277
- if (cursorField) {
163278
- return "";
163279
- }
163280
- const { value: node } = this.storage.get(id, "node");
163281
- if (!node) {
163282
- return "";
163283
- }
163284
- return node;
163285
- });
163279
+ if (updates?.includes("append") || updates?.includes("prepend")) {
163280
+ oldIDs = oldIDs.filter((id) => {
163281
+ for (const layer2 of this.storage.data) {
163282
+ for (const operation of Object.values(layer2.operations)) {
163283
+ if (operation.fields?.[key])
163284
+ for (const listOperation of operation.fields[key]) {
163285
+ if ("id" in listOperation && listOperation.id === id) {
163286
+ return false;
163287
+ }
163288
+ }
163289
+ }
163290
+ }
163291
+ return true;
163292
+ });
163293
+ }
163286
163294
  let linkedIDs = [];
163287
163295
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
163288
163296
  value,
@@ -163301,39 +163309,45 @@ var CacheInternal2 = class {
163301
163309
  layer.writeLink(parent2, key, linkedIDs);
163302
163310
  };
163303
163311
  if (applyUpdates && updates) {
163304
- if (key === "edges") {
163305
- const newNodeIDs = [];
163306
- for (const id of newIDs) {
163312
+ const filterIDs = (keep, insert) => {
163313
+ const existingIDs = /* @__PURE__ */ new Set();
163314
+ for (const id of keep) {
163307
163315
  if (!id) {
163308
163316
  continue;
163309
163317
  }
163310
163318
  const { value: node } = this.storage.get(id, "node");
163311
- if (typeof node !== "string") {
163319
+ if (!node) {
163312
163320
  continue;
163313
163321
  }
163314
- if (!node || !this.storage.get(node, "__typename")) {
163322
+ const nodeID = this.storage.get(node, "id");
163323
+ if (!nodeID) {
163315
163324
  continue;
163316
163325
  }
163317
- newNodeIDs.push(node);
163326
+ existingIDs.add(nodeID.value);
163318
163327
  }
163319
- oldIDs = oldIDs.filter((id) => {
163328
+ return insert.filter((id) => {
163320
163329
  if (!id) {
163321
163330
  return true;
163322
163331
  }
163323
- const { value: value2 } = this.storage.get(id, "node");
163324
- const node = value2;
163325
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
163326
- return false;
163332
+ const { value: node } = this.storage.get(id, "node");
163333
+ if (!node) {
163334
+ return true;
163327
163335
  }
163328
- return true;
163336
+ const nodeID = this.storage.get(node, "id");
163337
+ if (!nodeID) {
163338
+ return true;
163339
+ }
163340
+ return !existingIDs.has(nodeID.value);
163329
163341
  });
163330
- }
163342
+ };
163331
163343
  for (const update of applyUpdates) {
163332
163344
  if (update !== "replace" && !updates.includes(update)) {
163333
163345
  continue;
163334
163346
  }
163335
163347
  if (update === "prepend") {
163336
- linkedIDs = newIDs.concat(oldIDs);
163348
+ linkedIDs = newIDs.concat(
163349
+ filterIDs(newIDs, oldIDs)
163350
+ );
163337
163351
  if (layer?.optimistic) {
163338
163352
  action = () => {
163339
163353
  for (const id of newIDs) {
@@ -163344,7 +163358,7 @@ var CacheInternal2 = class {
163344
163358
  };
163345
163359
  }
163346
163360
  } else if (update === "append") {
163347
- linkedIDs = oldIDs.concat(newIDs);
163361
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
163348
163362
  if (layer?.optimistic) {
163349
163363
  action = () => {
163350
163364
  for (const id of newIDs) {