houdini-react 1.2.34 → 1.2.36
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 +33 -32
- package/build/plugin-esm/index.js +33 -32
- package/package.json +2 -2
|
@@ -77024,11 +77024,10 @@ var InMemorySubscriptions = class {
|
|
|
77024
77024
|
constructor(cache) {
|
|
77025
77025
|
this.cache = cache;
|
|
77026
77026
|
}
|
|
77027
|
-
subscribers =
|
|
77028
|
-
referenceCounts = {};
|
|
77027
|
+
subscribers = /* @__PURE__ */ new Map();
|
|
77029
77028
|
keyVersions = {};
|
|
77030
77029
|
activeFields(parent) {
|
|
77031
|
-
return Object.keys(this.subscribers
|
|
77030
|
+
return Object.keys(this.subscribers.get(parent) || {});
|
|
77032
77031
|
}
|
|
77033
77032
|
add({
|
|
77034
77033
|
parent,
|
|
@@ -77102,27 +77101,28 @@ var InMemorySubscriptions = class {
|
|
|
77102
77101
|
type
|
|
77103
77102
|
}) {
|
|
77104
77103
|
const spec = selection[0];
|
|
77105
|
-
if (!this.subscribers
|
|
77106
|
-
this.subscribers
|
|
77107
|
-
}
|
|
77108
|
-
|
|
77109
|
-
|
|
77104
|
+
if (!this.subscribers.has(id)) {
|
|
77105
|
+
this.subscribers.set(id, /* @__PURE__ */ new Map());
|
|
77106
|
+
}
|
|
77107
|
+
const subscriber = this.subscribers.get(id);
|
|
77108
|
+
if (!subscriber.has(key)) {
|
|
77109
|
+
subscriber.set(key, {
|
|
77110
|
+
selections: [],
|
|
77111
|
+
referenceCounts: /* @__PURE__ */ new Map()
|
|
77112
|
+
});
|
|
77110
77113
|
}
|
|
77114
|
+
const subscriberField = subscriber.get(key);
|
|
77111
77115
|
if (!this.keyVersions[key]) {
|
|
77112
77116
|
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
77113
77117
|
}
|
|
77114
77118
|
this.keyVersions[key].add(key);
|
|
77115
|
-
if (!
|
|
77116
|
-
|
|
77117
|
-
}
|
|
77118
|
-
if (!this.referenceCounts[id]) {
|
|
77119
|
-
this.referenceCounts[id] = {};
|
|
77119
|
+
if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
|
|
77120
|
+
subscriberField.selections.push([spec, selection[1]]);
|
|
77120
77121
|
}
|
|
77121
|
-
|
|
77122
|
-
|
|
77123
|
-
|
|
77124
|
-
|
|
77125
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
77122
|
+
subscriberField.referenceCounts.set(
|
|
77123
|
+
spec.set,
|
|
77124
|
+
(subscriberField.referenceCounts.get(spec.set) || 0) + 1
|
|
77125
|
+
);
|
|
77126
77126
|
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
77127
77127
|
}
|
|
77128
77128
|
registerList({
|
|
@@ -77209,7 +77209,7 @@ var InMemorySubscriptions = class {
|
|
|
77209
77209
|
}
|
|
77210
77210
|
}
|
|
77211
77211
|
get(id, field) {
|
|
77212
|
-
return this.subscribers
|
|
77212
|
+
return this.subscribers.get(id)?.get(field)?.selections || [];
|
|
77213
77213
|
}
|
|
77214
77214
|
remove(id, selection, targets, variables, visited = []) {
|
|
77215
77215
|
visited.push(id);
|
|
@@ -77235,24 +77235,24 @@ var InMemorySubscriptions = class {
|
|
|
77235
77235
|
}
|
|
77236
77236
|
}
|
|
77237
77237
|
reset() {
|
|
77238
|
-
const subscribers =
|
|
77239
|
-
([id]) => !id.startsWith(rootID)
|
|
77240
|
-
);
|
|
77238
|
+
const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
|
|
77241
77239
|
for (const [id, _fields] of subscribers) {
|
|
77242
|
-
|
|
77240
|
+
this.subscribers.delete(id);
|
|
77243
77241
|
}
|
|
77244
77242
|
const subscriptionSpecs = subscribers.flatMap(
|
|
77245
|
-
([_id, fields]) =>
|
|
77243
|
+
([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
|
|
77246
77244
|
);
|
|
77247
77245
|
return subscriptionSpecs;
|
|
77248
77246
|
}
|
|
77249
77247
|
removeSubscribers(id, fieldName, specs) {
|
|
77250
77248
|
let targets = [];
|
|
77249
|
+
const subscriber = this.subscribers.get(id);
|
|
77250
|
+
const subscriberField = subscriber?.get(fieldName);
|
|
77251
77251
|
for (const spec of specs) {
|
|
77252
|
-
|
|
77252
|
+
const counts = subscriber?.get(fieldName)?.referenceCounts;
|
|
77253
|
+
if (!counts?.has(spec.set)) {
|
|
77253
77254
|
continue;
|
|
77254
77255
|
}
|
|
77255
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
77256
77256
|
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
77257
77257
|
counts.set(spec.set, newVal);
|
|
77258
77258
|
if (newVal <= 0) {
|
|
@@ -77260,18 +77260,19 @@ var InMemorySubscriptions = class {
|
|
|
77260
77260
|
counts.delete(spec.set);
|
|
77261
77261
|
}
|
|
77262
77262
|
}
|
|
77263
|
-
if (
|
|
77264
|
-
|
|
77263
|
+
if (subscriberField) {
|
|
77264
|
+
subscriberField.selections = this.get(id, fieldName).filter(
|
|
77265
77265
|
([{ set }]) => !targets.includes(set)
|
|
77266
77266
|
);
|
|
77267
77267
|
}
|
|
77268
77268
|
}
|
|
77269
77269
|
removeAllSubscribers(id, targets, visited = []) {
|
|
77270
77270
|
visited.push(id);
|
|
77271
|
-
|
|
77272
|
-
|
|
77273
|
-
|
|
77274
|
-
|
|
77271
|
+
const subscriber = this.subscribers.get(id);
|
|
77272
|
+
for (const [key, val] of subscriber?.entries() ?? []) {
|
|
77273
|
+
const subscribers = targets || val.selections.map(([spec]) => spec);
|
|
77274
|
+
this.removeSubscribers(id, key, subscribers);
|
|
77275
|
+
const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
|
|
77275
77276
|
if (kind === "scalar") {
|
|
77276
77277
|
continue;
|
|
77277
77278
|
}
|
|
@@ -77014,11 +77014,10 @@ var InMemorySubscriptions = class {
|
|
|
77014
77014
|
constructor(cache) {
|
|
77015
77015
|
this.cache = cache;
|
|
77016
77016
|
}
|
|
77017
|
-
subscribers =
|
|
77018
|
-
referenceCounts = {};
|
|
77017
|
+
subscribers = /* @__PURE__ */ new Map();
|
|
77019
77018
|
keyVersions = {};
|
|
77020
77019
|
activeFields(parent) {
|
|
77021
|
-
return Object.keys(this.subscribers
|
|
77020
|
+
return Object.keys(this.subscribers.get(parent) || {});
|
|
77022
77021
|
}
|
|
77023
77022
|
add({
|
|
77024
77023
|
parent,
|
|
@@ -77092,27 +77091,28 @@ var InMemorySubscriptions = class {
|
|
|
77092
77091
|
type
|
|
77093
77092
|
}) {
|
|
77094
77093
|
const spec = selection[0];
|
|
77095
|
-
if (!this.subscribers
|
|
77096
|
-
this.subscribers
|
|
77097
|
-
}
|
|
77098
|
-
|
|
77099
|
-
|
|
77094
|
+
if (!this.subscribers.has(id)) {
|
|
77095
|
+
this.subscribers.set(id, /* @__PURE__ */ new Map());
|
|
77096
|
+
}
|
|
77097
|
+
const subscriber = this.subscribers.get(id);
|
|
77098
|
+
if (!subscriber.has(key)) {
|
|
77099
|
+
subscriber.set(key, {
|
|
77100
|
+
selections: [],
|
|
77101
|
+
referenceCounts: /* @__PURE__ */ new Map()
|
|
77102
|
+
});
|
|
77100
77103
|
}
|
|
77104
|
+
const subscriberField = subscriber.get(key);
|
|
77101
77105
|
if (!this.keyVersions[key]) {
|
|
77102
77106
|
this.keyVersions[key] = /* @__PURE__ */ new Set();
|
|
77103
77107
|
}
|
|
77104
77108
|
this.keyVersions[key].add(key);
|
|
77105
|
-
if (!
|
|
77106
|
-
|
|
77107
|
-
}
|
|
77108
|
-
if (!this.referenceCounts[id]) {
|
|
77109
|
-
this.referenceCounts[id] = {};
|
|
77109
|
+
if (!subscriberField.selections.some(([{ set }]) => set === spec.set)) {
|
|
77110
|
+
subscriberField.selections.push([spec, selection[1]]);
|
|
77110
77111
|
}
|
|
77111
|
-
|
|
77112
|
-
|
|
77113
|
-
|
|
77114
|
-
|
|
77115
|
-
counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
|
|
77112
|
+
subscriberField.referenceCounts.set(
|
|
77113
|
+
spec.set,
|
|
77114
|
+
(subscriberField.referenceCounts.get(spec.set) || 0) + 1
|
|
77115
|
+
);
|
|
77116
77116
|
this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
|
|
77117
77117
|
}
|
|
77118
77118
|
registerList({
|
|
@@ -77199,7 +77199,7 @@ var InMemorySubscriptions = class {
|
|
|
77199
77199
|
}
|
|
77200
77200
|
}
|
|
77201
77201
|
get(id, field) {
|
|
77202
|
-
return this.subscribers
|
|
77202
|
+
return this.subscribers.get(id)?.get(field)?.selections || [];
|
|
77203
77203
|
}
|
|
77204
77204
|
remove(id, selection, targets, variables, visited = []) {
|
|
77205
77205
|
visited.push(id);
|
|
@@ -77225,24 +77225,24 @@ var InMemorySubscriptions = class {
|
|
|
77225
77225
|
}
|
|
77226
77226
|
}
|
|
77227
77227
|
reset() {
|
|
77228
|
-
const subscribers =
|
|
77229
|
-
([id]) => !id.startsWith(rootID)
|
|
77230
|
-
);
|
|
77228
|
+
const subscribers = [...this.subscribers.entries()].filter(([id]) => !id.startsWith(rootID));
|
|
77231
77229
|
for (const [id, _fields] of subscribers) {
|
|
77232
|
-
|
|
77230
|
+
this.subscribers.delete(id);
|
|
77233
77231
|
}
|
|
77234
77232
|
const subscriptionSpecs = subscribers.flatMap(
|
|
77235
|
-
([_id, fields]) =>
|
|
77233
|
+
([_id, fields]) => [...fields.values()].flatMap((field) => field.selections.map(([spec]) => spec))
|
|
77236
77234
|
);
|
|
77237
77235
|
return subscriptionSpecs;
|
|
77238
77236
|
}
|
|
77239
77237
|
removeSubscribers(id, fieldName, specs) {
|
|
77240
77238
|
let targets = [];
|
|
77239
|
+
const subscriber = this.subscribers.get(id);
|
|
77240
|
+
const subscriberField = subscriber?.get(fieldName);
|
|
77241
77241
|
for (const spec of specs) {
|
|
77242
|
-
|
|
77242
|
+
const counts = subscriber?.get(fieldName)?.referenceCounts;
|
|
77243
|
+
if (!counts?.has(spec.set)) {
|
|
77243
77244
|
continue;
|
|
77244
77245
|
}
|
|
77245
|
-
const counts = this.referenceCounts[id][fieldName];
|
|
77246
77246
|
const newVal = (counts.get(spec.set) || 0) - 1;
|
|
77247
77247
|
counts.set(spec.set, newVal);
|
|
77248
77248
|
if (newVal <= 0) {
|
|
@@ -77250,18 +77250,19 @@ var InMemorySubscriptions = class {
|
|
|
77250
77250
|
counts.delete(spec.set);
|
|
77251
77251
|
}
|
|
77252
77252
|
}
|
|
77253
|
-
if (
|
|
77254
|
-
|
|
77253
|
+
if (subscriberField) {
|
|
77254
|
+
subscriberField.selections = this.get(id, fieldName).filter(
|
|
77255
77255
|
([{ set }]) => !targets.includes(set)
|
|
77256
77256
|
);
|
|
77257
77257
|
}
|
|
77258
77258
|
}
|
|
77259
77259
|
removeAllSubscribers(id, targets, visited = []) {
|
|
77260
77260
|
visited.push(id);
|
|
77261
|
-
|
|
77262
|
-
|
|
77263
|
-
|
|
77264
|
-
|
|
77261
|
+
const subscriber = this.subscribers.get(id);
|
|
77262
|
+
for (const [key, val] of subscriber?.entries() ?? []) {
|
|
77263
|
+
const subscribers = targets || val.selections.map(([spec]) => spec);
|
|
77264
|
+
this.removeSubscribers(id, key, subscribers);
|
|
77265
|
+
const { value, kind } = this.cache._internal_unstable.storage.get(id, key);
|
|
77265
77266
|
if (kind === "scalar") {
|
|
77266
77267
|
continue;
|
|
77267
77268
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.36",
|
|
4
4
|
"description": "The React plugin for houdini",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"recast": "^0.23.1",
|
|
44
44
|
"rollup": "^3.7.4",
|
|
45
45
|
"use-deep-compare-effect": "^1.8.1",
|
|
46
|
-
"houdini": "^1.2.
|
|
46
|
+
"houdini": "^1.2.36"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
49
|
"build"
|