houdini 2.0.0-next.1 → 2.0.0-next.2
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
|
@@ -74990,20 +74990,21 @@ var CacheInternal = class {
|
|
|
74990
74990
|
} else if (Array.isArray(value) && // make typescript happy
|
|
74991
74991
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
74992
74992
|
let oldIDs = [...previousValue || []];
|
|
74993
|
-
|
|
74994
|
-
|
|
74995
|
-
|
|
74996
|
-
|
|
74997
|
-
|
|
74998
|
-
|
|
74999
|
-
|
|
75000
|
-
|
|
75001
|
-
|
|
75002
|
-
|
|
75003
|
-
|
|
75004
|
-
|
|
75005
|
-
|
|
75006
|
-
|
|
74993
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
74994
|
+
oldIDs = oldIDs.filter((id) => {
|
|
74995
|
+
for (const layer2 of this.storage.data) {
|
|
74996
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
74997
|
+
if (operation.fields?.[key])
|
|
74998
|
+
for (const listOperation of operation.fields[key]) {
|
|
74999
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
75000
|
+
return false;
|
|
75001
|
+
}
|
|
75002
|
+
}
|
|
75003
|
+
}
|
|
75004
|
+
}
|
|
75005
|
+
return true;
|
|
75006
|
+
});
|
|
75007
|
+
}
|
|
75007
75008
|
let linkedIDs = [];
|
|
75008
75009
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
75009
75010
|
value,
|
|
@@ -75022,39 +75023,45 @@ var CacheInternal = class {
|
|
|
75022
75023
|
layer.writeLink(parent2, key, linkedIDs);
|
|
75023
75024
|
};
|
|
75024
75025
|
if (applyUpdates && updates) {
|
|
75025
|
-
|
|
75026
|
-
const
|
|
75027
|
-
for (const id of
|
|
75026
|
+
const filterIDs = (keep, insert) => {
|
|
75027
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
75028
|
+
for (const id of keep) {
|
|
75028
75029
|
if (!id) {
|
|
75029
75030
|
continue;
|
|
75030
75031
|
}
|
|
75031
75032
|
const { value: node } = this.storage.get(id, "node");
|
|
75032
|
-
if (
|
|
75033
|
+
if (!node) {
|
|
75033
75034
|
continue;
|
|
75034
75035
|
}
|
|
75035
|
-
|
|
75036
|
+
const nodeID = this.storage.get(node, "id");
|
|
75037
|
+
if (!nodeID) {
|
|
75036
75038
|
continue;
|
|
75037
75039
|
}
|
|
75038
|
-
|
|
75040
|
+
existingIDs.add(nodeID.value);
|
|
75039
75041
|
}
|
|
75040
|
-
|
|
75042
|
+
return insert.filter((id) => {
|
|
75041
75043
|
if (!id) {
|
|
75042
75044
|
return true;
|
|
75043
75045
|
}
|
|
75044
|
-
const { value:
|
|
75045
|
-
|
|
75046
|
-
|
|
75047
|
-
return false;
|
|
75046
|
+
const { value: node } = this.storage.get(id, "node");
|
|
75047
|
+
if (!node) {
|
|
75048
|
+
return true;
|
|
75048
75049
|
}
|
|
75049
|
-
|
|
75050
|
+
const nodeID = this.storage.get(node, "id");
|
|
75051
|
+
if (!nodeID) {
|
|
75052
|
+
return true;
|
|
75053
|
+
}
|
|
75054
|
+
return !existingIDs.has(nodeID.value);
|
|
75050
75055
|
});
|
|
75051
|
-
}
|
|
75056
|
+
};
|
|
75052
75057
|
for (const update of applyUpdates) {
|
|
75053
75058
|
if (update !== "replace" && !updates.includes(update)) {
|
|
75054
75059
|
continue;
|
|
75055
75060
|
}
|
|
75056
75061
|
if (update === "prepend") {
|
|
75057
|
-
linkedIDs = newIDs.concat(
|
|
75062
|
+
linkedIDs = newIDs.concat(
|
|
75063
|
+
filterIDs(newIDs, oldIDs)
|
|
75064
|
+
);
|
|
75058
75065
|
if (layer?.optimistic) {
|
|
75059
75066
|
action = () => {
|
|
75060
75067
|
for (const id of newIDs) {
|
|
@@ -75065,7 +75072,7 @@ var CacheInternal = class {
|
|
|
75065
75072
|
};
|
|
75066
75073
|
}
|
|
75067
75074
|
} else if (update === "append") {
|
|
75068
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
75075
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
75069
75076
|
if (layer?.optimistic) {
|
|
75070
75077
|
action = () => {
|
|
75071
75078
|
for (const id of newIDs) {
|