houdini-react 1.3.10 → 1.3.12
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/plugin-cjs/index.js +36 -29
- package/build/plugin-esm/index.js +36 -29
- package/package.json +2 -2
|
@@ -81647,20 +81647,21 @@ var CacheInternal = class {
|
|
|
81647
81647
|
}
|
|
81648
81648
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
81649
81649
|
let oldIDs = [...previousValue || []];
|
|
81650
|
-
|
|
81651
|
-
|
|
81652
|
-
|
|
81653
|
-
|
|
81654
|
-
|
|
81655
|
-
|
|
81656
|
-
|
|
81657
|
-
|
|
81658
|
-
|
|
81659
|
-
|
|
81660
|
-
|
|
81661
|
-
|
|
81662
|
-
|
|
81663
|
-
|
|
81650
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
81651
|
+
oldIDs = oldIDs.filter((id) => {
|
|
81652
|
+
for (const layer2 of this.storage.data) {
|
|
81653
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
81654
|
+
if (operation.fields?.[key])
|
|
81655
|
+
for (const listOperation of operation.fields[key]) {
|
|
81656
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
81657
|
+
return false;
|
|
81658
|
+
}
|
|
81659
|
+
}
|
|
81660
|
+
}
|
|
81661
|
+
}
|
|
81662
|
+
return true;
|
|
81663
|
+
});
|
|
81664
|
+
}
|
|
81664
81665
|
let linkedIDs = [];
|
|
81665
81666
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
81666
81667
|
value,
|
|
@@ -81679,39 +81680,45 @@ var CacheInternal = class {
|
|
|
81679
81680
|
layer.writeLink(parent, key, linkedIDs);
|
|
81680
81681
|
};
|
|
81681
81682
|
if (applyUpdates && updates) {
|
|
81682
|
-
|
|
81683
|
-
const
|
|
81684
|
-
for (const id of
|
|
81683
|
+
const filterIDs = (keep, insert) => {
|
|
81684
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
81685
|
+
for (const id of keep) {
|
|
81685
81686
|
if (!id) {
|
|
81686
81687
|
continue;
|
|
81687
81688
|
}
|
|
81688
81689
|
const { value: node } = this.storage.get(id, "node");
|
|
81689
|
-
if (
|
|
81690
|
+
if (!node) {
|
|
81690
81691
|
continue;
|
|
81691
81692
|
}
|
|
81692
|
-
|
|
81693
|
+
const nodeID = this.storage.get(node, "id");
|
|
81694
|
+
if (!nodeID) {
|
|
81693
81695
|
continue;
|
|
81694
81696
|
}
|
|
81695
|
-
|
|
81697
|
+
existingIDs.add(nodeID.value);
|
|
81696
81698
|
}
|
|
81697
|
-
|
|
81699
|
+
return insert.filter((id) => {
|
|
81698
81700
|
if (!id) {
|
|
81699
81701
|
return true;
|
|
81700
81702
|
}
|
|
81701
|
-
const { value:
|
|
81702
|
-
|
|
81703
|
-
|
|
81704
|
-
return false;
|
|
81703
|
+
const { value: node } = this.storage.get(id, "node");
|
|
81704
|
+
if (!node) {
|
|
81705
|
+
return true;
|
|
81705
81706
|
}
|
|
81706
|
-
|
|
81707
|
+
const nodeID = this.storage.get(node, "id");
|
|
81708
|
+
if (!nodeID) {
|
|
81709
|
+
return true;
|
|
81710
|
+
}
|
|
81711
|
+
return !existingIDs.has(nodeID.value);
|
|
81707
81712
|
});
|
|
81708
|
-
}
|
|
81713
|
+
};
|
|
81709
81714
|
for (const update of applyUpdates) {
|
|
81710
81715
|
if (update !== "replace" && !updates.includes(update)) {
|
|
81711
81716
|
continue;
|
|
81712
81717
|
}
|
|
81713
81718
|
if (update === "prepend") {
|
|
81714
|
-
linkedIDs = newIDs.concat(
|
|
81719
|
+
linkedIDs = newIDs.concat(
|
|
81720
|
+
filterIDs(newIDs, oldIDs)
|
|
81721
|
+
);
|
|
81715
81722
|
if (layer?.optimistic) {
|
|
81716
81723
|
action = () => {
|
|
81717
81724
|
for (const id of newIDs) {
|
|
@@ -81722,7 +81729,7 @@ var CacheInternal = class {
|
|
|
81722
81729
|
};
|
|
81723
81730
|
}
|
|
81724
81731
|
} else if (update === "append") {
|
|
81725
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
81732
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
81726
81733
|
if (layer?.optimistic) {
|
|
81727
81734
|
action = () => {
|
|
81728
81735
|
for (const id of newIDs) {
|
|
@@ -81639,20 +81639,21 @@ var CacheInternal = class {
|
|
|
81639
81639
|
}
|
|
81640
81640
|
} else if (Array.isArray(value) && (typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
81641
81641
|
let oldIDs = [...previousValue || []];
|
|
81642
|
-
|
|
81643
|
-
|
|
81644
|
-
|
|
81645
|
-
|
|
81646
|
-
|
|
81647
|
-
|
|
81648
|
-
|
|
81649
|
-
|
|
81650
|
-
|
|
81651
|
-
|
|
81652
|
-
|
|
81653
|
-
|
|
81654
|
-
|
|
81655
|
-
|
|
81642
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
81643
|
+
oldIDs = oldIDs.filter((id) => {
|
|
81644
|
+
for (const layer2 of this.storage.data) {
|
|
81645
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
81646
|
+
if (operation.fields?.[key])
|
|
81647
|
+
for (const listOperation of operation.fields[key]) {
|
|
81648
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
81649
|
+
return false;
|
|
81650
|
+
}
|
|
81651
|
+
}
|
|
81652
|
+
}
|
|
81653
|
+
}
|
|
81654
|
+
return true;
|
|
81655
|
+
});
|
|
81656
|
+
}
|
|
81656
81657
|
let linkedIDs = [];
|
|
81657
81658
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
81658
81659
|
value,
|
|
@@ -81671,39 +81672,45 @@ var CacheInternal = class {
|
|
|
81671
81672
|
layer.writeLink(parent, key, linkedIDs);
|
|
81672
81673
|
};
|
|
81673
81674
|
if (applyUpdates && updates) {
|
|
81674
|
-
|
|
81675
|
-
const
|
|
81676
|
-
for (const id of
|
|
81675
|
+
const filterIDs = (keep, insert) => {
|
|
81676
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
81677
|
+
for (const id of keep) {
|
|
81677
81678
|
if (!id) {
|
|
81678
81679
|
continue;
|
|
81679
81680
|
}
|
|
81680
81681
|
const { value: node } = this.storage.get(id, "node");
|
|
81681
|
-
if (
|
|
81682
|
+
if (!node) {
|
|
81682
81683
|
continue;
|
|
81683
81684
|
}
|
|
81684
|
-
|
|
81685
|
+
const nodeID = this.storage.get(node, "id");
|
|
81686
|
+
if (!nodeID) {
|
|
81685
81687
|
continue;
|
|
81686
81688
|
}
|
|
81687
|
-
|
|
81689
|
+
existingIDs.add(nodeID.value);
|
|
81688
81690
|
}
|
|
81689
|
-
|
|
81691
|
+
return insert.filter((id) => {
|
|
81690
81692
|
if (!id) {
|
|
81691
81693
|
return true;
|
|
81692
81694
|
}
|
|
81693
|
-
const { value:
|
|
81694
|
-
|
|
81695
|
-
|
|
81696
|
-
return false;
|
|
81695
|
+
const { value: node } = this.storage.get(id, "node");
|
|
81696
|
+
if (!node) {
|
|
81697
|
+
return true;
|
|
81697
81698
|
}
|
|
81698
|
-
|
|
81699
|
+
const nodeID = this.storage.get(node, "id");
|
|
81700
|
+
if (!nodeID) {
|
|
81701
|
+
return true;
|
|
81702
|
+
}
|
|
81703
|
+
return !existingIDs.has(nodeID.value);
|
|
81699
81704
|
});
|
|
81700
|
-
}
|
|
81705
|
+
};
|
|
81701
81706
|
for (const update of applyUpdates) {
|
|
81702
81707
|
if (update !== "replace" && !updates.includes(update)) {
|
|
81703
81708
|
continue;
|
|
81704
81709
|
}
|
|
81705
81710
|
if (update === "prepend") {
|
|
81706
|
-
linkedIDs = newIDs.concat(
|
|
81711
|
+
linkedIDs = newIDs.concat(
|
|
81712
|
+
filterIDs(newIDs, oldIDs)
|
|
81713
|
+
);
|
|
81707
81714
|
if (layer?.optimistic) {
|
|
81708
81715
|
action = () => {
|
|
81709
81716
|
for (const id of newIDs) {
|
|
@@ -81714,7 +81721,7 @@ var CacheInternal = class {
|
|
|
81714
81721
|
};
|
|
81715
81722
|
}
|
|
81716
81723
|
} else if (update === "append") {
|
|
81717
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
81724
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
81718
81725
|
if (layer?.optimistic) {
|
|
81719
81726
|
action = () => {
|
|
81720
81727
|
for (const id of newIDs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-react",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.12",
|
|
4
4
|
"description": "The React plugin for houdini",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"recast": "^0.23.1",
|
|
43
43
|
"rollup": "^4.28.1",
|
|
44
44
|
"use-deep-compare-effect": "^1.8.1",
|
|
45
|
-
"houdini": "^1.5.
|
|
45
|
+
"houdini": "^1.5.8"
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
48
48
|
"build"
|