houdini-svelte 2.1.17 → 2.1.19

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.
@@ -84651,20 +84651,21 @@ var CacheInternal = class {
84651
84651
  }
84652
84652
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
84653
84653
  let oldIDs = [...previousValue || []];
84654
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
84655
- if (!id) {
84656
- return "";
84657
- }
84658
- const { value: cursorField } = this.storage.get(id, "cursor");
84659
- if (cursorField) {
84660
- return "";
84661
- }
84662
- const { value: node } = this.storage.get(id, "node");
84663
- if (!node) {
84664
- return "";
84665
- }
84666
- return node;
84667
- });
84654
+ if (updates?.includes("append") || updates?.includes("prepend")) {
84655
+ oldIDs = oldIDs.filter((id) => {
84656
+ for (const layer2 of this.storage.data) {
84657
+ for (const operation of Object.values(layer2.operations)) {
84658
+ if (operation.fields?.[key])
84659
+ for (const listOperation of operation.fields[key]) {
84660
+ if ("id" in listOperation && listOperation.id === id) {
84661
+ return false;
84662
+ }
84663
+ }
84664
+ }
84665
+ }
84666
+ return true;
84667
+ });
84668
+ }
84668
84669
  let linkedIDs = [];
84669
84670
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
84670
84671
  value,
@@ -84683,39 +84684,45 @@ var CacheInternal = class {
84683
84684
  layer.writeLink(parent2, key, linkedIDs);
84684
84685
  };
84685
84686
  if (applyUpdates && updates) {
84686
- if (key === "edges") {
84687
- const newNodeIDs = [];
84688
- for (const id of newIDs) {
84687
+ const filterIDs = (keep, insert) => {
84688
+ const existingIDs = /* @__PURE__ */ new Set();
84689
+ for (const id of keep) {
84689
84690
  if (!id) {
84690
84691
  continue;
84691
84692
  }
84692
84693
  const { value: node } = this.storage.get(id, "node");
84693
- if (typeof node !== "string") {
84694
+ if (!node) {
84694
84695
  continue;
84695
84696
  }
84696
- if (!node || !this.storage.get(node, "__typename")) {
84697
+ const nodeID = this.storage.get(node, "id");
84698
+ if (!nodeID) {
84697
84699
  continue;
84698
84700
  }
84699
- newNodeIDs.push(node);
84701
+ existingIDs.add(nodeID.value);
84700
84702
  }
84701
- oldIDs = oldIDs.filter((id) => {
84703
+ return insert.filter((id) => {
84702
84704
  if (!id) {
84703
84705
  return true;
84704
84706
  }
84705
- const { value: value2 } = this.storage.get(id, "node");
84706
- const node = value2;
84707
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
84708
- return false;
84707
+ const { value: node } = this.storage.get(id, "node");
84708
+ if (!node) {
84709
+ return true;
84709
84710
  }
84710
- return true;
84711
+ const nodeID = this.storage.get(node, "id");
84712
+ if (!nodeID) {
84713
+ return true;
84714
+ }
84715
+ return !existingIDs.has(nodeID.value);
84711
84716
  });
84712
- }
84717
+ };
84713
84718
  for (const update of applyUpdates) {
84714
84719
  if (update !== "replace" && !updates.includes(update)) {
84715
84720
  continue;
84716
84721
  }
84717
84722
  if (update === "prepend") {
84718
- linkedIDs = newIDs.concat(oldIDs);
84723
+ linkedIDs = newIDs.concat(
84724
+ filterIDs(newIDs, oldIDs)
84725
+ );
84719
84726
  if (layer?.optimistic) {
84720
84727
  action = () => {
84721
84728
  for (const id of newIDs) {
@@ -84726,7 +84733,7 @@ var CacheInternal = class {
84726
84733
  };
84727
84734
  }
84728
84735
  } else if (update === "append") {
84729
- linkedIDs = oldIDs.concat(newIDs);
84736
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
84730
84737
  if (layer?.optimistic) {
84731
84738
  action = () => {
84732
84739
  for (const id of newIDs) {
@@ -154766,20 +154773,21 @@ var CacheInternal2 = class {
154766
154773
  }
154767
154774
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
154768
154775
  let oldIDs = [...previousValue || []];
154769
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
154770
- if (!id) {
154771
- return "";
154772
- }
154773
- const { value: cursorField } = this.storage.get(id, "cursor");
154774
- if (cursorField) {
154775
- return "";
154776
- }
154777
- const { value: node } = this.storage.get(id, "node");
154778
- if (!node) {
154779
- return "";
154780
- }
154781
- return node;
154782
- });
154776
+ if (updates?.includes("append") || updates?.includes("prepend")) {
154777
+ oldIDs = oldIDs.filter((id) => {
154778
+ for (const layer2 of this.storage.data) {
154779
+ for (const operation of Object.values(layer2.operations)) {
154780
+ if (operation.fields?.[key])
154781
+ for (const listOperation of operation.fields[key]) {
154782
+ if ("id" in listOperation && listOperation.id === id) {
154783
+ return false;
154784
+ }
154785
+ }
154786
+ }
154787
+ }
154788
+ return true;
154789
+ });
154790
+ }
154783
154791
  let linkedIDs = [];
154784
154792
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
154785
154793
  value,
@@ -154798,39 +154806,45 @@ var CacheInternal2 = class {
154798
154806
  layer.writeLink(parent2, key, linkedIDs);
154799
154807
  };
154800
154808
  if (applyUpdates && updates) {
154801
- if (key === "edges") {
154802
- const newNodeIDs = [];
154803
- for (const id of newIDs) {
154809
+ const filterIDs = (keep, insert) => {
154810
+ const existingIDs = /* @__PURE__ */ new Set();
154811
+ for (const id of keep) {
154804
154812
  if (!id) {
154805
154813
  continue;
154806
154814
  }
154807
154815
  const { value: node } = this.storage.get(id, "node");
154808
- if (typeof node !== "string") {
154816
+ if (!node) {
154809
154817
  continue;
154810
154818
  }
154811
- if (!node || !this.storage.get(node, "__typename")) {
154819
+ const nodeID = this.storage.get(node, "id");
154820
+ if (!nodeID) {
154812
154821
  continue;
154813
154822
  }
154814
- newNodeIDs.push(node);
154823
+ existingIDs.add(nodeID.value);
154815
154824
  }
154816
- oldIDs = oldIDs.filter((id) => {
154825
+ return insert.filter((id) => {
154817
154826
  if (!id) {
154818
154827
  return true;
154819
154828
  }
154820
- const { value: value2 } = this.storage.get(id, "node");
154821
- const node = value2;
154822
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
154823
- return false;
154829
+ const { value: node } = this.storage.get(id, "node");
154830
+ if (!node) {
154831
+ return true;
154824
154832
  }
154825
- return true;
154833
+ const nodeID = this.storage.get(node, "id");
154834
+ if (!nodeID) {
154835
+ return true;
154836
+ }
154837
+ return !existingIDs.has(nodeID.value);
154826
154838
  });
154827
- }
154839
+ };
154828
154840
  for (const update of applyUpdates) {
154829
154841
  if (update !== "replace" && !updates.includes(update)) {
154830
154842
  continue;
154831
154843
  }
154832
154844
  if (update === "prepend") {
154833
- linkedIDs = newIDs.concat(oldIDs);
154845
+ linkedIDs = newIDs.concat(
154846
+ filterIDs(newIDs, oldIDs)
154847
+ );
154834
154848
  if (layer?.optimistic) {
154835
154849
  action = () => {
154836
154850
  for (const id of newIDs) {
@@ -154841,7 +154855,7 @@ var CacheInternal2 = class {
154841
154855
  };
154842
154856
  }
154843
154857
  } else if (update === "append") {
154844
- linkedIDs = oldIDs.concat(newIDs);
154858
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
154845
154859
  if (layer?.optimistic) {
154846
154860
  action = () => {
154847
154861
  for (const id of newIDs) {
@@ -81318,20 +81318,21 @@ var CacheInternal = class {
81318
81318
  }
81319
81319
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
81320
81320
  let oldIDs = [...previousValue || []];
81321
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
81322
- if (!id) {
81323
- return "";
81324
- }
81325
- const { value: cursorField } = this.storage.get(id, "cursor");
81326
- if (cursorField) {
81327
- return "";
81328
- }
81329
- const { value: node } = this.storage.get(id, "node");
81330
- if (!node) {
81331
- return "";
81332
- }
81333
- return node;
81334
- });
81321
+ if (updates?.includes("append") || updates?.includes("prepend")) {
81322
+ oldIDs = oldIDs.filter((id) => {
81323
+ for (const layer2 of this.storage.data) {
81324
+ for (const operation of Object.values(layer2.operations)) {
81325
+ if (operation.fields?.[key])
81326
+ for (const listOperation of operation.fields[key]) {
81327
+ if ("id" in listOperation && listOperation.id === id) {
81328
+ return false;
81329
+ }
81330
+ }
81331
+ }
81332
+ }
81333
+ return true;
81334
+ });
81335
+ }
81335
81336
  let linkedIDs = [];
81336
81337
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
81337
81338
  value,
@@ -81350,39 +81351,45 @@ var CacheInternal = class {
81350
81351
  layer.writeLink(parent2, key, linkedIDs);
81351
81352
  };
81352
81353
  if (applyUpdates && updates) {
81353
- if (key === "edges") {
81354
- const newNodeIDs = [];
81355
- for (const id of newIDs) {
81354
+ const filterIDs = (keep, insert) => {
81355
+ const existingIDs = /* @__PURE__ */ new Set();
81356
+ for (const id of keep) {
81356
81357
  if (!id) {
81357
81358
  continue;
81358
81359
  }
81359
81360
  const { value: node } = this.storage.get(id, "node");
81360
- if (typeof node !== "string") {
81361
+ if (!node) {
81361
81362
  continue;
81362
81363
  }
81363
- if (!node || !this.storage.get(node, "__typename")) {
81364
+ const nodeID = this.storage.get(node, "id");
81365
+ if (!nodeID) {
81364
81366
  continue;
81365
81367
  }
81366
- newNodeIDs.push(node);
81368
+ existingIDs.add(nodeID.value);
81367
81369
  }
81368
- oldIDs = oldIDs.filter((id) => {
81370
+ return insert.filter((id) => {
81369
81371
  if (!id) {
81370
81372
  return true;
81371
81373
  }
81372
- const { value: value2 } = this.storage.get(id, "node");
81373
- const node = value2;
81374
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
81375
- return false;
81374
+ const { value: node } = this.storage.get(id, "node");
81375
+ if (!node) {
81376
+ return true;
81376
81377
  }
81377
- return true;
81378
+ const nodeID = this.storage.get(node, "id");
81379
+ if (!nodeID) {
81380
+ return true;
81381
+ }
81382
+ return !existingIDs.has(nodeID.value);
81378
81383
  });
81379
- }
81384
+ };
81380
81385
  for (const update of applyUpdates) {
81381
81386
  if (update !== "replace" && !updates.includes(update)) {
81382
81387
  continue;
81383
81388
  }
81384
81389
  if (update === "prepend") {
81385
- linkedIDs = newIDs.concat(oldIDs);
81390
+ linkedIDs = newIDs.concat(
81391
+ filterIDs(newIDs, oldIDs)
81392
+ );
81386
81393
  if (layer?.optimistic) {
81387
81394
  action = () => {
81388
81395
  for (const id of newIDs) {
@@ -81393,7 +81400,7 @@ var CacheInternal = class {
81393
81400
  };
81394
81401
  }
81395
81402
  } else if (update === "append") {
81396
- linkedIDs = oldIDs.concat(newIDs);
81403
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
81397
81404
  if (layer?.optimistic) {
81398
81405
  action = () => {
81399
81406
  for (const id of newIDs) {
@@ -142049,20 +142056,21 @@ var CacheInternal2 = class {
142049
142056
  }
142050
142057
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
142051
142058
  let oldIDs = [...previousValue || []];
142052
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
142053
- if (!id) {
142054
- return "";
142055
- }
142056
- const { value: cursorField } = this.storage.get(id, "cursor");
142057
- if (cursorField) {
142058
- return "";
142059
- }
142060
- const { value: node } = this.storage.get(id, "node");
142061
- if (!node) {
142062
- return "";
142063
- }
142064
- return node;
142065
- });
142059
+ if (updates?.includes("append") || updates?.includes("prepend")) {
142060
+ oldIDs = oldIDs.filter((id) => {
142061
+ for (const layer2 of this.storage.data) {
142062
+ for (const operation of Object.values(layer2.operations)) {
142063
+ if (operation.fields?.[key])
142064
+ for (const listOperation of operation.fields[key]) {
142065
+ if ("id" in listOperation && listOperation.id === id) {
142066
+ return false;
142067
+ }
142068
+ }
142069
+ }
142070
+ }
142071
+ return true;
142072
+ });
142073
+ }
142066
142074
  let linkedIDs = [];
142067
142075
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
142068
142076
  value,
@@ -142081,39 +142089,45 @@ var CacheInternal2 = class {
142081
142089
  layer.writeLink(parent2, key, linkedIDs);
142082
142090
  };
142083
142091
  if (applyUpdates && updates) {
142084
- if (key === "edges") {
142085
- const newNodeIDs = [];
142086
- for (const id of newIDs) {
142092
+ const filterIDs = (keep, insert) => {
142093
+ const existingIDs = /* @__PURE__ */ new Set();
142094
+ for (const id of keep) {
142087
142095
  if (!id) {
142088
142096
  continue;
142089
142097
  }
142090
142098
  const { value: node } = this.storage.get(id, "node");
142091
- if (typeof node !== "string") {
142099
+ if (!node) {
142092
142100
  continue;
142093
142101
  }
142094
- if (!node || !this.storage.get(node, "__typename")) {
142102
+ const nodeID = this.storage.get(node, "id");
142103
+ if (!nodeID) {
142095
142104
  continue;
142096
142105
  }
142097
- newNodeIDs.push(node);
142106
+ existingIDs.add(nodeID.value);
142098
142107
  }
142099
- oldIDs = oldIDs.filter((id) => {
142108
+ return insert.filter((id) => {
142100
142109
  if (!id) {
142101
142110
  return true;
142102
142111
  }
142103
- const { value: value2 } = this.storage.get(id, "node");
142104
- const node = value2;
142105
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
142106
- return false;
142112
+ const { value: node } = this.storage.get(id, "node");
142113
+ if (!node) {
142114
+ return true;
142107
142115
  }
142108
- return true;
142116
+ const nodeID = this.storage.get(node, "id");
142117
+ if (!nodeID) {
142118
+ return true;
142119
+ }
142120
+ return !existingIDs.has(nodeID.value);
142109
142121
  });
142110
- }
142122
+ };
142111
142123
  for (const update of applyUpdates) {
142112
142124
  if (update !== "replace" && !updates.includes(update)) {
142113
142125
  continue;
142114
142126
  }
142115
142127
  if (update === "prepend") {
142116
- linkedIDs = newIDs.concat(oldIDs);
142128
+ linkedIDs = newIDs.concat(
142129
+ filterIDs(newIDs, oldIDs)
142130
+ );
142117
142131
  if (layer?.optimistic) {
142118
142132
  action = () => {
142119
142133
  for (const id of newIDs) {
@@ -142124,7 +142138,7 @@ var CacheInternal2 = class {
142124
142138
  };
142125
142139
  }
142126
142140
  } else if (update === "append") {
142127
- linkedIDs = oldIDs.concat(newIDs);
142141
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
142128
142142
  if (layer?.optimistic) {
142129
142143
  action = () => {
142130
142144
  for (const id of newIDs) {
@@ -210180,20 +210194,21 @@ var CacheInternal3 = class {
210180
210194
  }
210181
210195
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
210182
210196
  let oldIDs = [...previousValue || []];
210183
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
210184
- if (!id) {
210185
- return "";
210186
- }
210187
- const { value: cursorField } = this.storage.get(id, "cursor");
210188
- if (cursorField) {
210189
- return "";
210190
- }
210191
- const { value: node } = this.storage.get(id, "node");
210192
- if (!node) {
210193
- return "";
210194
- }
210195
- return node;
210196
- });
210197
+ if (updates?.includes("append") || updates?.includes("prepend")) {
210198
+ oldIDs = oldIDs.filter((id) => {
210199
+ for (const layer2 of this.storage.data) {
210200
+ for (const operation of Object.values(layer2.operations)) {
210201
+ if (operation.fields?.[key])
210202
+ for (const listOperation of operation.fields[key]) {
210203
+ if ("id" in listOperation && listOperation.id === id) {
210204
+ return false;
210205
+ }
210206
+ }
210207
+ }
210208
+ }
210209
+ return true;
210210
+ });
210211
+ }
210197
210212
  let linkedIDs = [];
210198
210213
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
210199
210214
  value,
@@ -210212,39 +210227,45 @@ var CacheInternal3 = class {
210212
210227
  layer.writeLink(parent2, key, linkedIDs);
210213
210228
  };
210214
210229
  if (applyUpdates && updates) {
210215
- if (key === "edges") {
210216
- const newNodeIDs = [];
210217
- for (const id of newIDs) {
210230
+ const filterIDs = (keep, insert) => {
210231
+ const existingIDs = /* @__PURE__ */ new Set();
210232
+ for (const id of keep) {
210218
210233
  if (!id) {
210219
210234
  continue;
210220
210235
  }
210221
210236
  const { value: node } = this.storage.get(id, "node");
210222
- if (typeof node !== "string") {
210237
+ if (!node) {
210223
210238
  continue;
210224
210239
  }
210225
- if (!node || !this.storage.get(node, "__typename")) {
210240
+ const nodeID = this.storage.get(node, "id");
210241
+ if (!nodeID) {
210226
210242
  continue;
210227
210243
  }
210228
- newNodeIDs.push(node);
210244
+ existingIDs.add(nodeID.value);
210229
210245
  }
210230
- oldIDs = oldIDs.filter((id) => {
210246
+ return insert.filter((id) => {
210231
210247
  if (!id) {
210232
210248
  return true;
210233
210249
  }
210234
- const { value: value2 } = this.storage.get(id, "node");
210235
- const node = value2;
210236
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
210237
- return false;
210250
+ const { value: node } = this.storage.get(id, "node");
210251
+ if (!node) {
210252
+ return true;
210238
210253
  }
210239
- return true;
210254
+ const nodeID = this.storage.get(node, "id");
210255
+ if (!nodeID) {
210256
+ return true;
210257
+ }
210258
+ return !existingIDs.has(nodeID.value);
210240
210259
  });
210241
- }
210260
+ };
210242
210261
  for (const update of applyUpdates) {
210243
210262
  if (update !== "replace" && !updates.includes(update)) {
210244
210263
  continue;
210245
210264
  }
210246
210265
  if (update === "prepend") {
210247
- linkedIDs = newIDs.concat(oldIDs);
210266
+ linkedIDs = newIDs.concat(
210267
+ filterIDs(newIDs, oldIDs)
210268
+ );
210248
210269
  if (layer?.optimistic) {
210249
210270
  action = () => {
210250
210271
  for (const id of newIDs) {
@@ -210255,7 +210276,7 @@ var CacheInternal3 = class {
210255
210276
  };
210256
210277
  }
210257
210278
  } else if (update === "append") {
210258
- linkedIDs = oldIDs.concat(newIDs);
210279
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
210259
210280
  if (layer?.optimistic) {
210260
210281
  action = () => {
210261
210282
  for (const id of newIDs) {
@@ -280367,20 +280388,21 @@ var CacheInternal4 = class {
280367
280388
  }
280368
280389
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
280369
280390
  let oldIDs = [...previousValue || []];
280370
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
280371
- if (!id) {
280372
- return "";
280373
- }
280374
- const { value: cursorField } = this.storage.get(id, "cursor");
280375
- if (cursorField) {
280376
- return "";
280377
- }
280378
- const { value: node } = this.storage.get(id, "node");
280379
- if (!node) {
280380
- return "";
280381
- }
280382
- return node;
280383
- });
280391
+ if (updates?.includes("append") || updates?.includes("prepend")) {
280392
+ oldIDs = oldIDs.filter((id) => {
280393
+ for (const layer2 of this.storage.data) {
280394
+ for (const operation of Object.values(layer2.operations)) {
280395
+ if (operation.fields?.[key])
280396
+ for (const listOperation of operation.fields[key]) {
280397
+ if ("id" in listOperation && listOperation.id === id) {
280398
+ return false;
280399
+ }
280400
+ }
280401
+ }
280402
+ }
280403
+ return true;
280404
+ });
280405
+ }
280384
280406
  let linkedIDs = [];
280385
280407
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
280386
280408
  value,
@@ -280399,39 +280421,45 @@ var CacheInternal4 = class {
280399
280421
  layer.writeLink(parent2, key, linkedIDs);
280400
280422
  };
280401
280423
  if (applyUpdates && updates) {
280402
- if (key === "edges") {
280403
- const newNodeIDs = [];
280404
- for (const id of newIDs) {
280424
+ const filterIDs = (keep, insert) => {
280425
+ const existingIDs = /* @__PURE__ */ new Set();
280426
+ for (const id of keep) {
280405
280427
  if (!id) {
280406
280428
  continue;
280407
280429
  }
280408
280430
  const { value: node } = this.storage.get(id, "node");
280409
- if (typeof node !== "string") {
280431
+ if (!node) {
280410
280432
  continue;
280411
280433
  }
280412
- if (!node || !this.storage.get(node, "__typename")) {
280434
+ const nodeID = this.storage.get(node, "id");
280435
+ if (!nodeID) {
280413
280436
  continue;
280414
280437
  }
280415
- newNodeIDs.push(node);
280438
+ existingIDs.add(nodeID.value);
280416
280439
  }
280417
- oldIDs = oldIDs.filter((id) => {
280440
+ return insert.filter((id) => {
280418
280441
  if (!id) {
280419
280442
  return true;
280420
280443
  }
280421
- const { value: value2 } = this.storage.get(id, "node");
280422
- const node = value2;
280423
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
280424
- return false;
280444
+ const { value: node } = this.storage.get(id, "node");
280445
+ if (!node) {
280446
+ return true;
280425
280447
  }
280426
- return true;
280448
+ const nodeID = this.storage.get(node, "id");
280449
+ if (!nodeID) {
280450
+ return true;
280451
+ }
280452
+ return !existingIDs.has(nodeID.value);
280427
280453
  });
280428
- }
280454
+ };
280429
280455
  for (const update of applyUpdates) {
280430
280456
  if (update !== "replace" && !updates.includes(update)) {
280431
280457
  continue;
280432
280458
  }
280433
280459
  if (update === "prepend") {
280434
- linkedIDs = newIDs.concat(oldIDs);
280460
+ linkedIDs = newIDs.concat(
280461
+ filterIDs(newIDs, oldIDs)
280462
+ );
280435
280463
  if (layer?.optimistic) {
280436
280464
  action = () => {
280437
280465
  for (const id of newIDs) {
@@ -280442,7 +280470,7 @@ var CacheInternal4 = class {
280442
280470
  };
280443
280471
  }
280444
280472
  } else if (update === "append") {
280445
- linkedIDs = oldIDs.concat(newIDs);
280473
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
280446
280474
  if (layer?.optimistic) {
280447
280475
  action = () => {
280448
280476
  for (const id of newIDs) {