houdini 1.5.6 → 1.5.8
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/build/cmd-cjs/index.js +39 -31
- package/build/cmd-esm/index.js +39 -31
- package/build/codegen-cjs/index.js +36 -29
- package/build/codegen-esm/index.js +36 -29
- package/build/lib-cjs/index.js +36 -29
- package/build/lib-esm/index.js +36 -29
- package/build/runtime-cjs/cache/cache.js +36 -29
- package/build/runtime-esm/cache/cache.js +36 -29
- package/build/test-cjs/index.js +36 -29
- package/build/test-esm/index.js +36 -29
- package/build/vite-cjs/index.js +36 -29
- package/build/vite-esm/index.js +36 -29
- package/package.json +1 -1
package/build/lib-esm/index.js
CHANGED
|
@@ -69673,20 +69673,21 @@ var CacheInternal = class {
|
|
|
69673
69673
|
}
|
|
69674
69674
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
69675
69675
|
let oldIDs = [...previousValue || []];
|
|
69676
|
-
|
|
69677
|
-
|
|
69678
|
-
|
|
69679
|
-
|
|
69680
|
-
|
|
69681
|
-
|
|
69682
|
-
|
|
69683
|
-
|
|
69684
|
-
|
|
69685
|
-
|
|
69686
|
-
|
|
69687
|
-
|
|
69688
|
-
|
|
69689
|
-
|
|
69676
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
69677
|
+
oldIDs = oldIDs.filter((id) => {
|
|
69678
|
+
for (const layer2 of this.storage.data) {
|
|
69679
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
69680
|
+
if (operation.fields?.[key])
|
|
69681
|
+
for (const listOperation of operation.fields[key]) {
|
|
69682
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
69683
|
+
return false;
|
|
69684
|
+
}
|
|
69685
|
+
}
|
|
69686
|
+
}
|
|
69687
|
+
}
|
|
69688
|
+
return true;
|
|
69689
|
+
});
|
|
69690
|
+
}
|
|
69690
69691
|
let linkedIDs = [];
|
|
69691
69692
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
69692
69693
|
value,
|
|
@@ -69705,39 +69706,45 @@ var CacheInternal = class {
|
|
|
69705
69706
|
layer.writeLink(parent, key, linkedIDs);
|
|
69706
69707
|
};
|
|
69707
69708
|
if (applyUpdates && updates) {
|
|
69708
|
-
|
|
69709
|
-
const
|
|
69710
|
-
for (const id of
|
|
69709
|
+
const filterIDs = (keep, insert) => {
|
|
69710
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
69711
|
+
for (const id of keep) {
|
|
69711
69712
|
if (!id) {
|
|
69712
69713
|
continue;
|
|
69713
69714
|
}
|
|
69714
69715
|
const { value: node } = this.storage.get(id, "node");
|
|
69715
|
-
if (
|
|
69716
|
+
if (!node) {
|
|
69716
69717
|
continue;
|
|
69717
69718
|
}
|
|
69718
|
-
|
|
69719
|
+
const nodeID = this.storage.get(node, "id");
|
|
69720
|
+
if (!nodeID) {
|
|
69719
69721
|
continue;
|
|
69720
69722
|
}
|
|
69721
|
-
|
|
69723
|
+
existingIDs.add(nodeID.value);
|
|
69722
69724
|
}
|
|
69723
|
-
|
|
69725
|
+
return insert.filter((id) => {
|
|
69724
69726
|
if (!id) {
|
|
69725
69727
|
return true;
|
|
69726
69728
|
}
|
|
69727
|
-
const { value:
|
|
69728
|
-
|
|
69729
|
-
|
|
69730
|
-
return false;
|
|
69729
|
+
const { value: node } = this.storage.get(id, "node");
|
|
69730
|
+
if (!node) {
|
|
69731
|
+
return true;
|
|
69731
69732
|
}
|
|
69732
|
-
|
|
69733
|
+
const nodeID = this.storage.get(node, "id");
|
|
69734
|
+
if (!nodeID) {
|
|
69735
|
+
return true;
|
|
69736
|
+
}
|
|
69737
|
+
return !existingIDs.has(nodeID.value);
|
|
69733
69738
|
});
|
|
69734
|
-
}
|
|
69739
|
+
};
|
|
69735
69740
|
for (const update of applyUpdates) {
|
|
69736
69741
|
if (update !== "replace" && !updates.includes(update)) {
|
|
69737
69742
|
continue;
|
|
69738
69743
|
}
|
|
69739
69744
|
if (update === "prepend") {
|
|
69740
|
-
linkedIDs = newIDs.concat(
|
|
69745
|
+
linkedIDs = newIDs.concat(
|
|
69746
|
+
filterIDs(newIDs, oldIDs)
|
|
69747
|
+
);
|
|
69741
69748
|
if (layer?.optimistic) {
|
|
69742
69749
|
action = () => {
|
|
69743
69750
|
for (const id of newIDs) {
|
|
@@ -69748,7 +69755,7 @@ var CacheInternal = class {
|
|
|
69748
69755
|
};
|
|
69749
69756
|
}
|
|
69750
69757
|
} else if (update === "append") {
|
|
69751
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
69758
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
69752
69759
|
if (layer?.optimistic) {
|
|
69753
69760
|
action = () => {
|
|
69754
69761
|
for (const id of newIDs) {
|
|
@@ -399,20 +399,21 @@ class CacheInternal {
|
|
|
399
399
|
}
|
|
400
400
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
401
401
|
let oldIDs = [...previousValue || []];
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
402
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
403
|
+
oldIDs = oldIDs.filter((id) => {
|
|
404
|
+
for (const layer2 of this.storage.data) {
|
|
405
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
406
|
+
if (operation.fields?.[key])
|
|
407
|
+
for (const listOperation of operation.fields[key]) {
|
|
408
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
409
|
+
return false;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return true;
|
|
415
|
+
});
|
|
416
|
+
}
|
|
416
417
|
let linkedIDs = [];
|
|
417
418
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
418
419
|
value,
|
|
@@ -431,39 +432,45 @@ class CacheInternal {
|
|
|
431
432
|
layer.writeLink(parent, key, linkedIDs);
|
|
432
433
|
};
|
|
433
434
|
if (applyUpdates && updates) {
|
|
434
|
-
|
|
435
|
-
const
|
|
436
|
-
for (const id of
|
|
435
|
+
const filterIDs = (keep, insert) => {
|
|
436
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
437
|
+
for (const id of keep) {
|
|
437
438
|
if (!id) {
|
|
438
439
|
continue;
|
|
439
440
|
}
|
|
440
441
|
const { value: node } = this.storage.get(id, "node");
|
|
441
|
-
if (
|
|
442
|
+
if (!node) {
|
|
442
443
|
continue;
|
|
443
444
|
}
|
|
444
|
-
|
|
445
|
+
const nodeID = this.storage.get(node, "id");
|
|
446
|
+
if (!nodeID) {
|
|
445
447
|
continue;
|
|
446
448
|
}
|
|
447
|
-
|
|
449
|
+
existingIDs.add(nodeID.value);
|
|
448
450
|
}
|
|
449
|
-
|
|
451
|
+
return insert.filter((id) => {
|
|
450
452
|
if (!id) {
|
|
451
453
|
return true;
|
|
452
454
|
}
|
|
453
|
-
const { value:
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
455
|
+
const { value: node } = this.storage.get(id, "node");
|
|
456
|
+
if (!node) {
|
|
457
|
+
return true;
|
|
458
|
+
}
|
|
459
|
+
const nodeID = this.storage.get(node, "id");
|
|
460
|
+
if (!nodeID) {
|
|
461
|
+
return true;
|
|
457
462
|
}
|
|
458
|
-
return
|
|
463
|
+
return !existingIDs.has(nodeID.value);
|
|
459
464
|
});
|
|
460
|
-
}
|
|
465
|
+
};
|
|
461
466
|
for (const update of applyUpdates) {
|
|
462
467
|
if (update !== "replace" && !updates.includes(update)) {
|
|
463
468
|
continue;
|
|
464
469
|
}
|
|
465
470
|
if (update === "prepend") {
|
|
466
|
-
linkedIDs = newIDs.concat(
|
|
471
|
+
linkedIDs = newIDs.concat(
|
|
472
|
+
filterIDs(newIDs, oldIDs)
|
|
473
|
+
);
|
|
467
474
|
if (layer?.optimistic) {
|
|
468
475
|
action = () => {
|
|
469
476
|
for (const id of newIDs) {
|
|
@@ -474,7 +481,7 @@ class CacheInternal {
|
|
|
474
481
|
};
|
|
475
482
|
}
|
|
476
483
|
} else if (update === "append") {
|
|
477
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
484
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
478
485
|
if (layer?.optimistic) {
|
|
479
486
|
action = () => {
|
|
480
487
|
for (const id of newIDs) {
|
|
@@ -372,20 +372,21 @@ class CacheInternal {
|
|
|
372
372
|
}
|
|
373
373
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
374
374
|
let oldIDs = [...previousValue || []];
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
375
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
376
|
+
oldIDs = oldIDs.filter((id) => {
|
|
377
|
+
for (const layer2 of this.storage.data) {
|
|
378
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
379
|
+
if (operation.fields?.[key])
|
|
380
|
+
for (const listOperation of operation.fields[key]) {
|
|
381
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return true;
|
|
388
|
+
});
|
|
389
|
+
}
|
|
389
390
|
let linkedIDs = [];
|
|
390
391
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
391
392
|
value,
|
|
@@ -404,39 +405,45 @@ class CacheInternal {
|
|
|
404
405
|
layer.writeLink(parent, key, linkedIDs);
|
|
405
406
|
};
|
|
406
407
|
if (applyUpdates && updates) {
|
|
407
|
-
|
|
408
|
-
const
|
|
409
|
-
for (const id of
|
|
408
|
+
const filterIDs = (keep, insert) => {
|
|
409
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
410
|
+
for (const id of keep) {
|
|
410
411
|
if (!id) {
|
|
411
412
|
continue;
|
|
412
413
|
}
|
|
413
414
|
const { value: node } = this.storage.get(id, "node");
|
|
414
|
-
if (
|
|
415
|
+
if (!node) {
|
|
415
416
|
continue;
|
|
416
417
|
}
|
|
417
|
-
|
|
418
|
+
const nodeID = this.storage.get(node, "id");
|
|
419
|
+
if (!nodeID) {
|
|
418
420
|
continue;
|
|
419
421
|
}
|
|
420
|
-
|
|
422
|
+
existingIDs.add(nodeID.value);
|
|
421
423
|
}
|
|
422
|
-
|
|
424
|
+
return insert.filter((id) => {
|
|
423
425
|
if (!id) {
|
|
424
426
|
return true;
|
|
425
427
|
}
|
|
426
|
-
const { value:
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
const { value: node } = this.storage.get(id, "node");
|
|
429
|
+
if (!node) {
|
|
430
|
+
return true;
|
|
431
|
+
}
|
|
432
|
+
const nodeID = this.storage.get(node, "id");
|
|
433
|
+
if (!nodeID) {
|
|
434
|
+
return true;
|
|
430
435
|
}
|
|
431
|
-
return
|
|
436
|
+
return !existingIDs.has(nodeID.value);
|
|
432
437
|
});
|
|
433
|
-
}
|
|
438
|
+
};
|
|
434
439
|
for (const update of applyUpdates) {
|
|
435
440
|
if (update !== "replace" && !updates.includes(update)) {
|
|
436
441
|
continue;
|
|
437
442
|
}
|
|
438
443
|
if (update === "prepend") {
|
|
439
|
-
linkedIDs = newIDs.concat(
|
|
444
|
+
linkedIDs = newIDs.concat(
|
|
445
|
+
filterIDs(newIDs, oldIDs)
|
|
446
|
+
);
|
|
440
447
|
if (layer?.optimistic) {
|
|
441
448
|
action = () => {
|
|
442
449
|
for (const id of newIDs) {
|
|
@@ -447,7 +454,7 @@ class CacheInternal {
|
|
|
447
454
|
};
|
|
448
455
|
}
|
|
449
456
|
} else if (update === "append") {
|
|
450
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
457
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
451
458
|
if (layer?.optimistic) {
|
|
452
459
|
action = () => {
|
|
453
460
|
for (const id of newIDs) {
|
package/build/test-cjs/index.js
CHANGED
|
@@ -60149,20 +60149,21 @@ var CacheInternal = class {
|
|
|
60149
60149
|
}
|
|
60150
60150
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
60151
60151
|
let oldIDs = [...previousValue || []];
|
|
60152
|
-
|
|
60153
|
-
|
|
60154
|
-
|
|
60155
|
-
|
|
60156
|
-
|
|
60157
|
-
|
|
60158
|
-
|
|
60159
|
-
|
|
60160
|
-
|
|
60161
|
-
|
|
60162
|
-
|
|
60163
|
-
|
|
60164
|
-
|
|
60165
|
-
|
|
60152
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
60153
|
+
oldIDs = oldIDs.filter((id) => {
|
|
60154
|
+
for (const layer2 of this.storage.data) {
|
|
60155
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
60156
|
+
if (operation.fields?.[key])
|
|
60157
|
+
for (const listOperation of operation.fields[key]) {
|
|
60158
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
60159
|
+
return false;
|
|
60160
|
+
}
|
|
60161
|
+
}
|
|
60162
|
+
}
|
|
60163
|
+
}
|
|
60164
|
+
return true;
|
|
60165
|
+
});
|
|
60166
|
+
}
|
|
60166
60167
|
let linkedIDs = [];
|
|
60167
60168
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
60168
60169
|
value,
|
|
@@ -60181,39 +60182,45 @@ var CacheInternal = class {
|
|
|
60181
60182
|
layer.writeLink(parent2, key, linkedIDs);
|
|
60182
60183
|
};
|
|
60183
60184
|
if (applyUpdates && updates) {
|
|
60184
|
-
|
|
60185
|
-
const
|
|
60186
|
-
for (const id of
|
|
60185
|
+
const filterIDs = (keep, insert) => {
|
|
60186
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
60187
|
+
for (const id of keep) {
|
|
60187
60188
|
if (!id) {
|
|
60188
60189
|
continue;
|
|
60189
60190
|
}
|
|
60190
60191
|
const { value: node } = this.storage.get(id, "node");
|
|
60191
|
-
if (
|
|
60192
|
+
if (!node) {
|
|
60192
60193
|
continue;
|
|
60193
60194
|
}
|
|
60194
|
-
|
|
60195
|
+
const nodeID = this.storage.get(node, "id");
|
|
60196
|
+
if (!nodeID) {
|
|
60195
60197
|
continue;
|
|
60196
60198
|
}
|
|
60197
|
-
|
|
60199
|
+
existingIDs.add(nodeID.value);
|
|
60198
60200
|
}
|
|
60199
|
-
|
|
60201
|
+
return insert.filter((id) => {
|
|
60200
60202
|
if (!id) {
|
|
60201
60203
|
return true;
|
|
60202
60204
|
}
|
|
60203
|
-
const { value:
|
|
60204
|
-
|
|
60205
|
-
|
|
60206
|
-
return false;
|
|
60205
|
+
const { value: node } = this.storage.get(id, "node");
|
|
60206
|
+
if (!node) {
|
|
60207
|
+
return true;
|
|
60207
60208
|
}
|
|
60208
|
-
|
|
60209
|
+
const nodeID = this.storage.get(node, "id");
|
|
60210
|
+
if (!nodeID) {
|
|
60211
|
+
return true;
|
|
60212
|
+
}
|
|
60213
|
+
return !existingIDs.has(nodeID.value);
|
|
60209
60214
|
});
|
|
60210
|
-
}
|
|
60215
|
+
};
|
|
60211
60216
|
for (const update of applyUpdates) {
|
|
60212
60217
|
if (update !== "replace" && !updates.includes(update)) {
|
|
60213
60218
|
continue;
|
|
60214
60219
|
}
|
|
60215
60220
|
if (update === "prepend") {
|
|
60216
|
-
linkedIDs = newIDs.concat(
|
|
60221
|
+
linkedIDs = newIDs.concat(
|
|
60222
|
+
filterIDs(newIDs, oldIDs)
|
|
60223
|
+
);
|
|
60217
60224
|
if (layer?.optimistic) {
|
|
60218
60225
|
action = () => {
|
|
60219
60226
|
for (const id of newIDs) {
|
|
@@ -60224,7 +60231,7 @@ var CacheInternal = class {
|
|
|
60224
60231
|
};
|
|
60225
60232
|
}
|
|
60226
60233
|
} else if (update === "append") {
|
|
60227
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
60234
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
60228
60235
|
if (layer?.optimistic) {
|
|
60229
60236
|
action = () => {
|
|
60230
60237
|
for (const id of newIDs) {
|
package/build/test-esm/index.js
CHANGED
|
@@ -60146,20 +60146,21 @@ var CacheInternal = class {
|
|
|
60146
60146
|
}
|
|
60147
60147
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
60148
60148
|
let oldIDs = [...previousValue || []];
|
|
60149
|
-
|
|
60150
|
-
|
|
60151
|
-
|
|
60152
|
-
|
|
60153
|
-
|
|
60154
|
-
|
|
60155
|
-
|
|
60156
|
-
|
|
60157
|
-
|
|
60158
|
-
|
|
60159
|
-
|
|
60160
|
-
|
|
60161
|
-
|
|
60162
|
-
|
|
60149
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
60150
|
+
oldIDs = oldIDs.filter((id) => {
|
|
60151
|
+
for (const layer2 of this.storage.data) {
|
|
60152
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
60153
|
+
if (operation.fields?.[key])
|
|
60154
|
+
for (const listOperation of operation.fields[key]) {
|
|
60155
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
60156
|
+
return false;
|
|
60157
|
+
}
|
|
60158
|
+
}
|
|
60159
|
+
}
|
|
60160
|
+
}
|
|
60161
|
+
return true;
|
|
60162
|
+
});
|
|
60163
|
+
}
|
|
60163
60164
|
let linkedIDs = [];
|
|
60164
60165
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
60165
60166
|
value,
|
|
@@ -60178,39 +60179,45 @@ var CacheInternal = class {
|
|
|
60178
60179
|
layer.writeLink(parent2, key, linkedIDs);
|
|
60179
60180
|
};
|
|
60180
60181
|
if (applyUpdates && updates) {
|
|
60181
|
-
|
|
60182
|
-
const
|
|
60183
|
-
for (const id of
|
|
60182
|
+
const filterIDs = (keep, insert) => {
|
|
60183
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
60184
|
+
for (const id of keep) {
|
|
60184
60185
|
if (!id) {
|
|
60185
60186
|
continue;
|
|
60186
60187
|
}
|
|
60187
60188
|
const { value: node } = this.storage.get(id, "node");
|
|
60188
|
-
if (
|
|
60189
|
+
if (!node) {
|
|
60189
60190
|
continue;
|
|
60190
60191
|
}
|
|
60191
|
-
|
|
60192
|
+
const nodeID = this.storage.get(node, "id");
|
|
60193
|
+
if (!nodeID) {
|
|
60192
60194
|
continue;
|
|
60193
60195
|
}
|
|
60194
|
-
|
|
60196
|
+
existingIDs.add(nodeID.value);
|
|
60195
60197
|
}
|
|
60196
|
-
|
|
60198
|
+
return insert.filter((id) => {
|
|
60197
60199
|
if (!id) {
|
|
60198
60200
|
return true;
|
|
60199
60201
|
}
|
|
60200
|
-
const { value:
|
|
60201
|
-
|
|
60202
|
-
|
|
60203
|
-
return false;
|
|
60202
|
+
const { value: node } = this.storage.get(id, "node");
|
|
60203
|
+
if (!node) {
|
|
60204
|
+
return true;
|
|
60204
60205
|
}
|
|
60205
|
-
|
|
60206
|
+
const nodeID = this.storage.get(node, "id");
|
|
60207
|
+
if (!nodeID) {
|
|
60208
|
+
return true;
|
|
60209
|
+
}
|
|
60210
|
+
return !existingIDs.has(nodeID.value);
|
|
60206
60211
|
});
|
|
60207
|
-
}
|
|
60212
|
+
};
|
|
60208
60213
|
for (const update of applyUpdates) {
|
|
60209
60214
|
if (update !== "replace" && !updates.includes(update)) {
|
|
60210
60215
|
continue;
|
|
60211
60216
|
}
|
|
60212
60217
|
if (update === "prepend") {
|
|
60213
|
-
linkedIDs = newIDs.concat(
|
|
60218
|
+
linkedIDs = newIDs.concat(
|
|
60219
|
+
filterIDs(newIDs, oldIDs)
|
|
60220
|
+
);
|
|
60214
60221
|
if (layer?.optimistic) {
|
|
60215
60222
|
action = () => {
|
|
60216
60223
|
for (const id of newIDs) {
|
|
@@ -60221,7 +60228,7 @@ var CacheInternal = class {
|
|
|
60221
60228
|
};
|
|
60222
60229
|
}
|
|
60223
60230
|
} else if (update === "append") {
|
|
60224
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
60231
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
60225
60232
|
if (layer?.optimistic) {
|
|
60226
60233
|
action = () => {
|
|
60227
60234
|
for (const id of newIDs) {
|
package/build/vite-cjs/index.js
CHANGED
|
@@ -72568,20 +72568,21 @@ var CacheInternal = class {
|
|
|
72568
72568
|
}
|
|
72569
72569
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
72570
72570
|
let oldIDs = [...previousValue || []];
|
|
72571
|
-
|
|
72572
|
-
|
|
72573
|
-
|
|
72574
|
-
|
|
72575
|
-
|
|
72576
|
-
|
|
72577
|
-
|
|
72578
|
-
|
|
72579
|
-
|
|
72580
|
-
|
|
72581
|
-
|
|
72582
|
-
|
|
72583
|
-
|
|
72584
|
-
|
|
72571
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
72572
|
+
oldIDs = oldIDs.filter((id) => {
|
|
72573
|
+
for (const layer2 of this.storage.data) {
|
|
72574
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
72575
|
+
if (operation.fields?.[key])
|
|
72576
|
+
for (const listOperation of operation.fields[key]) {
|
|
72577
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
72578
|
+
return false;
|
|
72579
|
+
}
|
|
72580
|
+
}
|
|
72581
|
+
}
|
|
72582
|
+
}
|
|
72583
|
+
return true;
|
|
72584
|
+
});
|
|
72585
|
+
}
|
|
72585
72586
|
let linkedIDs = [];
|
|
72586
72587
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
72587
72588
|
value,
|
|
@@ -72600,39 +72601,45 @@ var CacheInternal = class {
|
|
|
72600
72601
|
layer.writeLink(parent2, key, linkedIDs);
|
|
72601
72602
|
};
|
|
72602
72603
|
if (applyUpdates && updates) {
|
|
72603
|
-
|
|
72604
|
-
const
|
|
72605
|
-
for (const id of
|
|
72604
|
+
const filterIDs = (keep, insert) => {
|
|
72605
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
72606
|
+
for (const id of keep) {
|
|
72606
72607
|
if (!id) {
|
|
72607
72608
|
continue;
|
|
72608
72609
|
}
|
|
72609
72610
|
const { value: node } = this.storage.get(id, "node");
|
|
72610
|
-
if (
|
|
72611
|
+
if (!node) {
|
|
72611
72612
|
continue;
|
|
72612
72613
|
}
|
|
72613
|
-
|
|
72614
|
+
const nodeID = this.storage.get(node, "id");
|
|
72615
|
+
if (!nodeID) {
|
|
72614
72616
|
continue;
|
|
72615
72617
|
}
|
|
72616
|
-
|
|
72618
|
+
existingIDs.add(nodeID.value);
|
|
72617
72619
|
}
|
|
72618
|
-
|
|
72620
|
+
return insert.filter((id) => {
|
|
72619
72621
|
if (!id) {
|
|
72620
72622
|
return true;
|
|
72621
72623
|
}
|
|
72622
|
-
const { value:
|
|
72623
|
-
|
|
72624
|
-
|
|
72625
|
-
return false;
|
|
72624
|
+
const { value: node } = this.storage.get(id, "node");
|
|
72625
|
+
if (!node) {
|
|
72626
|
+
return true;
|
|
72626
72627
|
}
|
|
72627
|
-
|
|
72628
|
+
const nodeID = this.storage.get(node, "id");
|
|
72629
|
+
if (!nodeID) {
|
|
72630
|
+
return true;
|
|
72631
|
+
}
|
|
72632
|
+
return !existingIDs.has(nodeID.value);
|
|
72628
72633
|
});
|
|
72629
|
-
}
|
|
72634
|
+
};
|
|
72630
72635
|
for (const update of applyUpdates) {
|
|
72631
72636
|
if (update !== "replace" && !updates.includes(update)) {
|
|
72632
72637
|
continue;
|
|
72633
72638
|
}
|
|
72634
72639
|
if (update === "prepend") {
|
|
72635
|
-
linkedIDs = newIDs.concat(
|
|
72640
|
+
linkedIDs = newIDs.concat(
|
|
72641
|
+
filterIDs(newIDs, oldIDs)
|
|
72642
|
+
);
|
|
72636
72643
|
if (layer?.optimistic) {
|
|
72637
72644
|
action = () => {
|
|
72638
72645
|
for (const id of newIDs) {
|
|
@@ -72643,7 +72650,7 @@ var CacheInternal = class {
|
|
|
72643
72650
|
};
|
|
72644
72651
|
}
|
|
72645
72652
|
} else if (update === "append") {
|
|
72646
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
72653
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
72647
72654
|
if (layer?.optimistic) {
|
|
72648
72655
|
action = () => {
|
|
72649
72656
|
for (const id of newIDs) {
|