houdini-svelte 2.1.16 → 2.1.18

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.
@@ -81314,20 +81314,21 @@ var CacheInternal = class {
81314
81314
  }
81315
81315
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
81316
81316
  let oldIDs = [...previousValue || []];
81317
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
81318
- if (!id) {
81319
- return "";
81320
- }
81321
- const { value: cursorField } = this.storage.get(id, "cursor");
81322
- if (cursorField) {
81323
- return "";
81324
- }
81325
- const { value: node } = this.storage.get(id, "node");
81326
- if (!node) {
81327
- return "";
81328
- }
81329
- return node;
81330
- });
81317
+ if (updates?.includes("append") || updates?.includes("prepend")) {
81318
+ oldIDs = oldIDs.filter((id) => {
81319
+ for (const layer2 of this.storage.data) {
81320
+ for (const operation of Object.values(layer2.operations)) {
81321
+ if (operation.fields?.[key])
81322
+ for (const listOperation of operation.fields[key]) {
81323
+ if ("id" in listOperation && listOperation.id === id) {
81324
+ return false;
81325
+ }
81326
+ }
81327
+ }
81328
+ }
81329
+ return true;
81330
+ });
81331
+ }
81331
81332
  let linkedIDs = [];
81332
81333
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
81333
81334
  value,
@@ -81346,39 +81347,45 @@ var CacheInternal = class {
81346
81347
  layer.writeLink(parent2, key, linkedIDs);
81347
81348
  };
81348
81349
  if (applyUpdates && updates) {
81349
- if (key === "edges") {
81350
- const newNodeIDs = [];
81351
- for (const id of newIDs) {
81350
+ const filterIDs = (keep, insert) => {
81351
+ const existingIDs = /* @__PURE__ */ new Set();
81352
+ for (const id of keep) {
81352
81353
  if (!id) {
81353
81354
  continue;
81354
81355
  }
81355
81356
  const { value: node } = this.storage.get(id, "node");
81356
- if (typeof node !== "string") {
81357
+ if (!node) {
81357
81358
  continue;
81358
81359
  }
81359
- if (!node || !this.storage.get(node, "__typename")) {
81360
+ const nodeID = this.storage.get(node, "id");
81361
+ if (!nodeID) {
81360
81362
  continue;
81361
81363
  }
81362
- newNodeIDs.push(node);
81364
+ existingIDs.add(nodeID.value);
81363
81365
  }
81364
- oldIDs = oldIDs.filter((id) => {
81366
+ return insert.filter((id) => {
81365
81367
  if (!id) {
81366
81368
  return true;
81367
81369
  }
81368
- const { value: value2 } = this.storage.get(id, "node");
81369
- const node = value2;
81370
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
81371
- return false;
81370
+ const { value: node } = this.storage.get(id, "node");
81371
+ if (!node) {
81372
+ return true;
81372
81373
  }
81373
- return true;
81374
+ const nodeID = this.storage.get(node, "id");
81375
+ if (!nodeID) {
81376
+ return true;
81377
+ }
81378
+ return !existingIDs.has(nodeID.value);
81374
81379
  });
81375
- }
81380
+ };
81376
81381
  for (const update of applyUpdates) {
81377
81382
  if (update !== "replace" && !updates.includes(update)) {
81378
81383
  continue;
81379
81384
  }
81380
81385
  if (update === "prepend") {
81381
- linkedIDs = newIDs.concat(oldIDs);
81386
+ linkedIDs = newIDs.concat(
81387
+ filterIDs(newIDs, oldIDs)
81388
+ );
81382
81389
  if (layer?.optimistic) {
81383
81390
  action = () => {
81384
81391
  for (const id of newIDs) {
@@ -81389,7 +81396,7 @@ var CacheInternal = class {
81389
81396
  };
81390
81397
  }
81391
81398
  } else if (update === "append") {
81392
- linkedIDs = oldIDs.concat(newIDs);
81399
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
81393
81400
  if (layer?.optimistic) {
81394
81401
  action = () => {
81395
81402
  for (const id of newIDs) {
@@ -150487,20 +150494,21 @@ var CacheInternal2 = class {
150487
150494
  }
150488
150495
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
150489
150496
  let oldIDs = [...previousValue || []];
150490
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
150491
- if (!id) {
150492
- return "";
150493
- }
150494
- const { value: cursorField } = this.storage.get(id, "cursor");
150495
- if (cursorField) {
150496
- return "";
150497
- }
150498
- const { value: node } = this.storage.get(id, "node");
150499
- if (!node) {
150500
- return "";
150501
- }
150502
- return node;
150503
- });
150497
+ if (updates?.includes("append") || updates?.includes("prepend")) {
150498
+ oldIDs = oldIDs.filter((id) => {
150499
+ for (const layer2 of this.storage.data) {
150500
+ for (const operation of Object.values(layer2.operations)) {
150501
+ if (operation.fields?.[key])
150502
+ for (const listOperation of operation.fields[key]) {
150503
+ if ("id" in listOperation && listOperation.id === id) {
150504
+ return false;
150505
+ }
150506
+ }
150507
+ }
150508
+ }
150509
+ return true;
150510
+ });
150511
+ }
150504
150512
  let linkedIDs = [];
150505
150513
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
150506
150514
  value,
@@ -150519,39 +150527,45 @@ var CacheInternal2 = class {
150519
150527
  layer.writeLink(parent2, key, linkedIDs);
150520
150528
  };
150521
150529
  if (applyUpdates && updates) {
150522
- if (key === "edges") {
150523
- const newNodeIDs = [];
150524
- for (const id of newIDs) {
150530
+ const filterIDs = (keep, insert) => {
150531
+ const existingIDs = /* @__PURE__ */ new Set();
150532
+ for (const id of keep) {
150525
150533
  if (!id) {
150526
150534
  continue;
150527
150535
  }
150528
150536
  const { value: node } = this.storage.get(id, "node");
150529
- if (typeof node !== "string") {
150537
+ if (!node) {
150530
150538
  continue;
150531
150539
  }
150532
- if (!node || !this.storage.get(node, "__typename")) {
150540
+ const nodeID = this.storage.get(node, "id");
150541
+ if (!nodeID) {
150533
150542
  continue;
150534
150543
  }
150535
- newNodeIDs.push(node);
150544
+ existingIDs.add(nodeID.value);
150536
150545
  }
150537
- oldIDs = oldIDs.filter((id) => {
150546
+ return insert.filter((id) => {
150538
150547
  if (!id) {
150539
150548
  return true;
150540
150549
  }
150541
- const { value: value2 } = this.storage.get(id, "node");
150542
- const node = value2;
150543
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
150544
- return false;
150550
+ const { value: node } = this.storage.get(id, "node");
150551
+ if (!node) {
150552
+ return true;
150545
150553
  }
150546
- return true;
150554
+ const nodeID = this.storage.get(node, "id");
150555
+ if (!nodeID) {
150556
+ return true;
150557
+ }
150558
+ return !existingIDs.has(nodeID.value);
150547
150559
  });
150548
- }
150560
+ };
150549
150561
  for (const update of applyUpdates) {
150550
150562
  if (update !== "replace" && !updates.includes(update)) {
150551
150563
  continue;
150552
150564
  }
150553
150565
  if (update === "prepend") {
150554
- linkedIDs = newIDs.concat(oldIDs);
150566
+ linkedIDs = newIDs.concat(
150567
+ filterIDs(newIDs, oldIDs)
150568
+ );
150555
150569
  if (layer?.optimistic) {
150556
150570
  action = () => {
150557
150571
  for (const id of newIDs) {
@@ -150562,7 +150576,7 @@ var CacheInternal2 = class {
150562
150576
  };
150563
150577
  }
150564
150578
  } else if (update === "append") {
150565
- linkedIDs = oldIDs.concat(newIDs);
150579
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
150566
150580
  if (layer?.optimistic) {
150567
150581
  action = () => {
150568
150582
  for (const id of newIDs) {
@@ -81310,20 +81310,21 @@ var CacheInternal = class {
81310
81310
  }
81311
81311
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
81312
81312
  let oldIDs = [...previousValue || []];
81313
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
81314
- if (!id) {
81315
- return "";
81316
- }
81317
- const { value: cursorField } = this.storage.get(id, "cursor");
81318
- if (cursorField) {
81319
- return "";
81320
- }
81321
- const { value: node } = this.storage.get(id, "node");
81322
- if (!node) {
81323
- return "";
81324
- }
81325
- return node;
81326
- });
81313
+ if (updates?.includes("append") || updates?.includes("prepend")) {
81314
+ oldIDs = oldIDs.filter((id) => {
81315
+ for (const layer2 of this.storage.data) {
81316
+ for (const operation of Object.values(layer2.operations)) {
81317
+ if (operation.fields?.[key])
81318
+ for (const listOperation of operation.fields[key]) {
81319
+ if ("id" in listOperation && listOperation.id === id) {
81320
+ return false;
81321
+ }
81322
+ }
81323
+ }
81324
+ }
81325
+ return true;
81326
+ });
81327
+ }
81327
81328
  let linkedIDs = [];
81328
81329
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
81329
81330
  value,
@@ -81342,39 +81343,45 @@ var CacheInternal = class {
81342
81343
  layer.writeLink(parent2, key, linkedIDs);
81343
81344
  };
81344
81345
  if (applyUpdates && updates) {
81345
- if (key === "edges") {
81346
- const newNodeIDs = [];
81347
- for (const id of newIDs) {
81346
+ const filterIDs = (keep, insert) => {
81347
+ const existingIDs = /* @__PURE__ */ new Set();
81348
+ for (const id of keep) {
81348
81349
  if (!id) {
81349
81350
  continue;
81350
81351
  }
81351
81352
  const { value: node } = this.storage.get(id, "node");
81352
- if (typeof node !== "string") {
81353
+ if (!node) {
81353
81354
  continue;
81354
81355
  }
81355
- if (!node || !this.storage.get(node, "__typename")) {
81356
+ const nodeID = this.storage.get(node, "id");
81357
+ if (!nodeID) {
81356
81358
  continue;
81357
81359
  }
81358
- newNodeIDs.push(node);
81360
+ existingIDs.add(nodeID.value);
81359
81361
  }
81360
- oldIDs = oldIDs.filter((id) => {
81362
+ return insert.filter((id) => {
81361
81363
  if (!id) {
81362
81364
  return true;
81363
81365
  }
81364
- const { value: value2 } = this.storage.get(id, "node");
81365
- const node = value2;
81366
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
81367
- return false;
81366
+ const { value: node } = this.storage.get(id, "node");
81367
+ if (!node) {
81368
+ return true;
81368
81369
  }
81369
- return true;
81370
+ const nodeID = this.storage.get(node, "id");
81371
+ if (!nodeID) {
81372
+ return true;
81373
+ }
81374
+ return !existingIDs.has(nodeID.value);
81370
81375
  });
81371
- }
81376
+ };
81372
81377
  for (const update of applyUpdates) {
81373
81378
  if (update !== "replace" && !updates.includes(update)) {
81374
81379
  continue;
81375
81380
  }
81376
81381
  if (update === "prepend") {
81377
- linkedIDs = newIDs.concat(oldIDs);
81382
+ linkedIDs = newIDs.concat(
81383
+ filterIDs(newIDs, oldIDs)
81384
+ );
81378
81385
  if (layer?.optimistic) {
81379
81386
  action = () => {
81380
81387
  for (const id of newIDs) {
@@ -81385,7 +81392,7 @@ var CacheInternal = class {
81385
81392
  };
81386
81393
  }
81387
81394
  } else if (update === "append") {
81388
- linkedIDs = oldIDs.concat(newIDs);
81395
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
81389
81396
  if (layer?.optimistic) {
81390
81397
  action = () => {
81391
81398
  for (const id of newIDs) {
@@ -150482,20 +150489,21 @@ var CacheInternal2 = class {
150482
150489
  }
150483
150490
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
150484
150491
  let oldIDs = [...previousValue || []];
150485
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
150486
- if (!id) {
150487
- return "";
150488
- }
150489
- const { value: cursorField } = this.storage.get(id, "cursor");
150490
- if (cursorField) {
150491
- return "";
150492
- }
150493
- const { value: node } = this.storage.get(id, "node");
150494
- if (!node) {
150495
- return "";
150496
- }
150497
- return node;
150498
- });
150492
+ if (updates?.includes("append") || updates?.includes("prepend")) {
150493
+ oldIDs = oldIDs.filter((id) => {
150494
+ for (const layer2 of this.storage.data) {
150495
+ for (const operation of Object.values(layer2.operations)) {
150496
+ if (operation.fields?.[key])
150497
+ for (const listOperation of operation.fields[key]) {
150498
+ if ("id" in listOperation && listOperation.id === id) {
150499
+ return false;
150500
+ }
150501
+ }
150502
+ }
150503
+ }
150504
+ return true;
150505
+ });
150506
+ }
150499
150507
  let linkedIDs = [];
150500
150508
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
150501
150509
  value,
@@ -150514,39 +150522,45 @@ var CacheInternal2 = class {
150514
150522
  layer.writeLink(parent2, key, linkedIDs);
150515
150523
  };
150516
150524
  if (applyUpdates && updates) {
150517
- if (key === "edges") {
150518
- const newNodeIDs = [];
150519
- for (const id of newIDs) {
150525
+ const filterIDs = (keep, insert) => {
150526
+ const existingIDs = /* @__PURE__ */ new Set();
150527
+ for (const id of keep) {
150520
150528
  if (!id) {
150521
150529
  continue;
150522
150530
  }
150523
150531
  const { value: node } = this.storage.get(id, "node");
150524
- if (typeof node !== "string") {
150532
+ if (!node) {
150525
150533
  continue;
150526
150534
  }
150527
- if (!node || !this.storage.get(node, "__typename")) {
150535
+ const nodeID = this.storage.get(node, "id");
150536
+ if (!nodeID) {
150528
150537
  continue;
150529
150538
  }
150530
- newNodeIDs.push(node);
150539
+ existingIDs.add(nodeID.value);
150531
150540
  }
150532
- oldIDs = oldIDs.filter((id) => {
150541
+ return insert.filter((id) => {
150533
150542
  if (!id) {
150534
150543
  return true;
150535
150544
  }
150536
- const { value: value2 } = this.storage.get(id, "node");
150537
- const node = value2;
150538
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
150539
- return false;
150545
+ const { value: node } = this.storage.get(id, "node");
150546
+ if (!node) {
150547
+ return true;
150540
150548
  }
150541
- return true;
150549
+ const nodeID = this.storage.get(node, "id");
150550
+ if (!nodeID) {
150551
+ return true;
150552
+ }
150553
+ return !existingIDs.has(nodeID.value);
150542
150554
  });
150543
- }
150555
+ };
150544
150556
  for (const update of applyUpdates) {
150545
150557
  if (update !== "replace" && !updates.includes(update)) {
150546
150558
  continue;
150547
150559
  }
150548
150560
  if (update === "prepend") {
150549
- linkedIDs = newIDs.concat(oldIDs);
150561
+ linkedIDs = newIDs.concat(
150562
+ filterIDs(newIDs, oldIDs)
150563
+ );
150550
150564
  if (layer?.optimistic) {
150551
150565
  action = () => {
150552
150566
  for (const id of newIDs) {
@@ -150557,7 +150571,7 @@ var CacheInternal2 = class {
150557
150571
  };
150558
150572
  }
150559
150573
  } else if (update === "append") {
150560
- linkedIDs = oldIDs.concat(newIDs);
150574
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
150561
150575
  if (layer?.optimistic) {
150562
150576
  action = () => {
150563
150577
  for (const id of newIDs) {
@@ -84654,20 +84654,21 @@ var CacheInternal = class {
84654
84654
  }
84655
84655
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
84656
84656
  let oldIDs = [...previousValue || []];
84657
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
84658
- if (!id) {
84659
- return "";
84660
- }
84661
- const { value: cursorField } = this.storage.get(id, "cursor");
84662
- if (cursorField) {
84663
- return "";
84664
- }
84665
- const { value: node } = this.storage.get(id, "node");
84666
- if (!node) {
84667
- return "";
84668
- }
84669
- return node;
84670
- });
84657
+ if (updates?.includes("append") || updates?.includes("prepend")) {
84658
+ oldIDs = oldIDs.filter((id) => {
84659
+ for (const layer2 of this.storage.data) {
84660
+ for (const operation of Object.values(layer2.operations)) {
84661
+ if (operation.fields?.[key])
84662
+ for (const listOperation of operation.fields[key]) {
84663
+ if ("id" in listOperation && listOperation.id === id) {
84664
+ return false;
84665
+ }
84666
+ }
84667
+ }
84668
+ }
84669
+ return true;
84670
+ });
84671
+ }
84671
84672
  let linkedIDs = [];
84672
84673
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
84673
84674
  value,
@@ -84686,39 +84687,45 @@ var CacheInternal = class {
84686
84687
  layer.writeLink(parent2, key, linkedIDs);
84687
84688
  };
84688
84689
  if (applyUpdates && updates) {
84689
- if (key === "edges") {
84690
- const newNodeIDs = [];
84691
- for (const id of newIDs) {
84690
+ const filterIDs = (keep, insert) => {
84691
+ const existingIDs = /* @__PURE__ */ new Set();
84692
+ for (const id of keep) {
84692
84693
  if (!id) {
84693
84694
  continue;
84694
84695
  }
84695
84696
  const { value: node } = this.storage.get(id, "node");
84696
- if (typeof node !== "string") {
84697
+ if (!node) {
84697
84698
  continue;
84698
84699
  }
84699
- if (!node || !this.storage.get(node, "__typename")) {
84700
+ const nodeID = this.storage.get(node, "id");
84701
+ if (!nodeID) {
84700
84702
  continue;
84701
84703
  }
84702
- newNodeIDs.push(node);
84704
+ existingIDs.add(nodeID.value);
84703
84705
  }
84704
- oldIDs = oldIDs.filter((id) => {
84706
+ return insert.filter((id) => {
84705
84707
  if (!id) {
84706
84708
  return true;
84707
84709
  }
84708
- const { value: value2 } = this.storage.get(id, "node");
84709
- const node = value2;
84710
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
84711
- return false;
84710
+ const { value: node } = this.storage.get(id, "node");
84711
+ if (!node) {
84712
+ return true;
84712
84713
  }
84713
- return true;
84714
+ const nodeID = this.storage.get(node, "id");
84715
+ if (!nodeID) {
84716
+ return true;
84717
+ }
84718
+ return !existingIDs.has(nodeID.value);
84714
84719
  });
84715
- }
84720
+ };
84716
84721
  for (const update of applyUpdates) {
84717
84722
  if (update !== "replace" && !updates.includes(update)) {
84718
84723
  continue;
84719
84724
  }
84720
84725
  if (update === "prepend") {
84721
- linkedIDs = newIDs.concat(oldIDs);
84726
+ linkedIDs = newIDs.concat(
84727
+ filterIDs(newIDs, oldIDs)
84728
+ );
84722
84729
  if (layer?.optimistic) {
84723
84730
  action = () => {
84724
84731
  for (const id of newIDs) {
@@ -84729,7 +84736,7 @@ var CacheInternal = class {
84729
84736
  };
84730
84737
  }
84731
84738
  } else if (update === "append") {
84732
- linkedIDs = oldIDs.concat(newIDs);
84739
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
84733
84740
  if (layer?.optimistic) {
84734
84741
  action = () => {
84735
84742
  for (const id of newIDs) {
@@ -154770,20 +154777,21 @@ var CacheInternal2 = class {
154770
154777
  }
154771
154778
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
154772
154779
  let oldIDs = [...previousValue || []];
154773
- const emptyEdges = !updates ? [] : oldIDs.map((id) => {
154774
- if (!id) {
154775
- return "";
154776
- }
154777
- const { value: cursorField } = this.storage.get(id, "cursor");
154778
- if (cursorField) {
154779
- return "";
154780
- }
154781
- const { value: node } = this.storage.get(id, "node");
154782
- if (!node) {
154783
- return "";
154784
- }
154785
- return node;
154786
- });
154780
+ if (updates?.includes("append") || updates?.includes("prepend")) {
154781
+ oldIDs = oldIDs.filter((id) => {
154782
+ for (const layer2 of this.storage.data) {
154783
+ for (const operation of Object.values(layer2.operations)) {
154784
+ if (operation.fields?.[key])
154785
+ for (const listOperation of operation.fields[key]) {
154786
+ if ("id" in listOperation && listOperation.id === id) {
154787
+ return false;
154788
+ }
154789
+ }
154790
+ }
154791
+ }
154792
+ return true;
154793
+ });
154794
+ }
154787
154795
  let linkedIDs = [];
154788
154796
  const { newIDs, nestedIDs } = this.extractNestedListIDs({
154789
154797
  value,
@@ -154802,39 +154810,45 @@ var CacheInternal2 = class {
154802
154810
  layer.writeLink(parent2, key, linkedIDs);
154803
154811
  };
154804
154812
  if (applyUpdates && updates) {
154805
- if (key === "edges") {
154806
- const newNodeIDs = [];
154807
- for (const id of newIDs) {
154813
+ const filterIDs = (keep, insert) => {
154814
+ const existingIDs = /* @__PURE__ */ new Set();
154815
+ for (const id of keep) {
154808
154816
  if (!id) {
154809
154817
  continue;
154810
154818
  }
154811
154819
  const { value: node } = this.storage.get(id, "node");
154812
- if (typeof node !== "string") {
154820
+ if (!node) {
154813
154821
  continue;
154814
154822
  }
154815
- if (!node || !this.storage.get(node, "__typename")) {
154823
+ const nodeID = this.storage.get(node, "id");
154824
+ if (!nodeID) {
154816
154825
  continue;
154817
154826
  }
154818
- newNodeIDs.push(node);
154827
+ existingIDs.add(nodeID.value);
154819
154828
  }
154820
- oldIDs = oldIDs.filter((id) => {
154829
+ return insert.filter((id) => {
154821
154830
  if (!id) {
154822
154831
  return true;
154823
154832
  }
154824
- const { value: value2 } = this.storage.get(id, "node");
154825
- const node = value2;
154826
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
154827
- return false;
154833
+ const { value: node } = this.storage.get(id, "node");
154834
+ if (!node) {
154835
+ return true;
154828
154836
  }
154829
- return true;
154837
+ const nodeID = this.storage.get(node, "id");
154838
+ if (!nodeID) {
154839
+ return true;
154840
+ }
154841
+ return !existingIDs.has(nodeID.value);
154830
154842
  });
154831
- }
154843
+ };
154832
154844
  for (const update of applyUpdates) {
154833
154845
  if (update !== "replace" && !updates.includes(update)) {
154834
154846
  continue;
154835
154847
  }
154836
154848
  if (update === "prepend") {
154837
- linkedIDs = newIDs.concat(oldIDs);
154849
+ linkedIDs = newIDs.concat(
154850
+ filterIDs(newIDs, oldIDs)
154851
+ );
154838
154852
  if (layer?.optimistic) {
154839
154853
  action = () => {
154840
154854
  for (const id of newIDs) {
@@ -154845,7 +154859,7 @@ var CacheInternal2 = class {
154845
154859
  };
154846
154860
  }
154847
154861
  } else if (update === "append") {
154848
- linkedIDs = oldIDs.concat(newIDs);
154862
+ linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
154849
154863
  if (layer?.optimistic) {
154850
154864
  action = () => {
154851
154865
  for (const id of newIDs) {