houdini 1.5.7 → 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 +38 -31
- package/build/cmd-esm/index.js +38 -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/vite-esm/index.js
CHANGED
|
@@ -72562,20 +72562,21 @@ var CacheInternal = class {
|
|
|
72562
72562
|
}
|
|
72563
72563
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
72564
72564
|
let oldIDs = [...previousValue || []];
|
|
72565
|
-
|
|
72566
|
-
|
|
72567
|
-
|
|
72568
|
-
|
|
72569
|
-
|
|
72570
|
-
|
|
72571
|
-
|
|
72572
|
-
|
|
72573
|
-
|
|
72574
|
-
|
|
72575
|
-
|
|
72576
|
-
|
|
72577
|
-
|
|
72578
|
-
|
|
72565
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
72566
|
+
oldIDs = oldIDs.filter((id) => {
|
|
72567
|
+
for (const layer2 of this.storage.data) {
|
|
72568
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
72569
|
+
if (operation.fields?.[key])
|
|
72570
|
+
for (const listOperation of operation.fields[key]) {
|
|
72571
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
72572
|
+
return false;
|
|
72573
|
+
}
|
|
72574
|
+
}
|
|
72575
|
+
}
|
|
72576
|
+
}
|
|
72577
|
+
return true;
|
|
72578
|
+
});
|
|
72579
|
+
}
|
|
72579
72580
|
let linkedIDs = [];
|
|
72580
72581
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
72581
72582
|
value,
|
|
@@ -72594,39 +72595,45 @@ var CacheInternal = class {
|
|
|
72594
72595
|
layer.writeLink(parent2, key, linkedIDs);
|
|
72595
72596
|
};
|
|
72596
72597
|
if (applyUpdates && updates) {
|
|
72597
|
-
|
|
72598
|
-
const
|
|
72599
|
-
for (const id of
|
|
72598
|
+
const filterIDs = (keep, insert) => {
|
|
72599
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
72600
|
+
for (const id of keep) {
|
|
72600
72601
|
if (!id) {
|
|
72601
72602
|
continue;
|
|
72602
72603
|
}
|
|
72603
72604
|
const { value: node } = this.storage.get(id, "node");
|
|
72604
|
-
if (
|
|
72605
|
+
if (!node) {
|
|
72605
72606
|
continue;
|
|
72606
72607
|
}
|
|
72607
|
-
|
|
72608
|
+
const nodeID = this.storage.get(node, "id");
|
|
72609
|
+
if (!nodeID) {
|
|
72608
72610
|
continue;
|
|
72609
72611
|
}
|
|
72610
|
-
|
|
72612
|
+
existingIDs.add(nodeID.value);
|
|
72611
72613
|
}
|
|
72612
|
-
|
|
72614
|
+
return insert.filter((id) => {
|
|
72613
72615
|
if (!id) {
|
|
72614
72616
|
return true;
|
|
72615
72617
|
}
|
|
72616
|
-
const { value:
|
|
72617
|
-
|
|
72618
|
-
|
|
72619
|
-
return false;
|
|
72618
|
+
const { value: node } = this.storage.get(id, "node");
|
|
72619
|
+
if (!node) {
|
|
72620
|
+
return true;
|
|
72620
72621
|
}
|
|
72621
|
-
|
|
72622
|
+
const nodeID = this.storage.get(node, "id");
|
|
72623
|
+
if (!nodeID) {
|
|
72624
|
+
return true;
|
|
72625
|
+
}
|
|
72626
|
+
return !existingIDs.has(nodeID.value);
|
|
72622
72627
|
});
|
|
72623
|
-
}
|
|
72628
|
+
};
|
|
72624
72629
|
for (const update of applyUpdates) {
|
|
72625
72630
|
if (update !== "replace" && !updates.includes(update)) {
|
|
72626
72631
|
continue;
|
|
72627
72632
|
}
|
|
72628
72633
|
if (update === "prepend") {
|
|
72629
|
-
linkedIDs = newIDs.concat(
|
|
72634
|
+
linkedIDs = newIDs.concat(
|
|
72635
|
+
filterIDs(newIDs, oldIDs)
|
|
72636
|
+
);
|
|
72630
72637
|
if (layer?.optimistic) {
|
|
72631
72638
|
action = () => {
|
|
72632
72639
|
for (const id of newIDs) {
|
|
@@ -72637,7 +72644,7 @@ var CacheInternal = class {
|
|
|
72637
72644
|
};
|
|
72638
72645
|
}
|
|
72639
72646
|
} else if (update === "append") {
|
|
72640
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
72647
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
72641
72648
|
if (layer?.optimistic) {
|
|
72642
72649
|
action = () => {
|
|
72643
72650
|
for (const id of newIDs) {
|