houdini-react 1.3.0 → 1.3.1

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.
@@ -76105,7 +76105,18 @@ var ListManager = class {
76105
76105
  }
76106
76106
  lists = /* @__PURE__ */ new Map();
76107
76107
  listsByField = /* @__PURE__ */ new Map();
76108
- get(listName, id, allLists) {
76108
+ get(listName, id, allLists, skipMatches) {
76109
+ const lists = this.getLists(listName, id, allLists);
76110
+ if (!lists) {
76111
+ return null;
76112
+ }
76113
+ if (skipMatches) {
76114
+ return new ListCollection(lists.lists.filter((list) => !skipMatches.has(list.fieldRef)));
76115
+ } else {
76116
+ return lists;
76117
+ }
76118
+ }
76119
+ getLists(listName, id, allLists) {
76109
76120
  const matches = this.lists.get(listName);
76110
76121
  if (!matches || matches.size === 0) {
76111
76122
  return null;
@@ -76227,6 +76238,9 @@ var List = class {
76227
76238
  this.manager = manager;
76228
76239
  this.abstract = abstract;
76229
76240
  }
76241
+ get fieldRef() {
76242
+ return `${this.recordID}.${this.key}`;
76243
+ }
76230
76244
  when(when) {
76231
76245
  return this.manager.lists.get(this.name).get(this.recordID).when(when);
76232
76246
  }
@@ -77371,8 +77385,8 @@ var Cache = class {
77371
77385
  variables
77372
77386
  );
77373
77387
  }
77374
- list(name, parentID, allLists) {
77375
- const handler = this._internal_unstable.lists.get(name, parentID, allLists);
77388
+ list(name, parentID, allLists, skipMatches) {
77389
+ const handler = this._internal_unstable.lists.get(name, parentID, allLists, skipMatches);
77376
77390
  if (!handler) {
77377
77391
  throw new Error(
77378
77392
  `Cannot find list with name: ${name}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
@@ -77787,6 +77801,7 @@ var CacheInternal = class {
77787
77801
  });
77788
77802
  }
77789
77803
  }
77804
+ const processedOperations = /* @__PURE__ */ new Set();
77790
77805
  for (const operation of operations || []) {
77791
77806
  let parentID;
77792
77807
  if (operation.parentID) {
@@ -77806,7 +77821,12 @@ var CacheInternal = class {
77806
77821
  const targets = Array.isArray(value) ? value : [value];
77807
77822
  for (const target of targets) {
77808
77823
  if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
77809
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
77824
+ this.cache.list(
77825
+ operation.list,
77826
+ parentID,
77827
+ operation.target === "all",
77828
+ processedOperations
77829
+ ).when(operation.when).addToList(
77810
77830
  fieldSelection,
77811
77831
  target,
77812
77832
  variables,
@@ -77814,7 +77834,12 @@ var CacheInternal = class {
77814
77834
  layer
77815
77835
  );
77816
77836
  } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
77817
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
77837
+ this.cache.list(
77838
+ operation.list,
77839
+ parentID,
77840
+ operation.target === "all",
77841
+ processedOperations
77842
+ ).when(operation.when).toggleElement({
77818
77843
  selection: fieldSelection,
77819
77844
  data: target,
77820
77845
  variables,
@@ -77822,7 +77847,12 @@ var CacheInternal = class {
77822
77847
  layer
77823
77848
  });
77824
77849
  } else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
77825
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
77850
+ this.cache.list(
77851
+ operation.list,
77852
+ parentID,
77853
+ operation.target === "all",
77854
+ processedOperations
77855
+ ).when(operation.when).remove(target, variables, layer);
77826
77856
  } else if (operation.action === "delete" && operation.type && target) {
77827
77857
  const targetID = this.id(operation.type, target);
77828
77858
  if (!targetID) {
@@ -77834,6 +77864,16 @@ var CacheInternal = class {
77834
77864
  this.cache.delete(targetID, layer);
77835
77865
  }
77836
77866
  }
77867
+ if (operation.list) {
77868
+ const matchingLists = this.cache.list(
77869
+ operation.list,
77870
+ parentID,
77871
+ operation.target === "all"
77872
+ );
77873
+ for (const list of matchingLists.lists) {
77874
+ processedOperations.add(list.fieldRef);
77875
+ }
77876
+ }
77837
77877
  }
77838
77878
  }
77839
77879
  return toNotify;
@@ -76095,7 +76095,18 @@ var ListManager = class {
76095
76095
  }
76096
76096
  lists = /* @__PURE__ */ new Map();
76097
76097
  listsByField = /* @__PURE__ */ new Map();
76098
- get(listName, id, allLists) {
76098
+ get(listName, id, allLists, skipMatches) {
76099
+ const lists = this.getLists(listName, id, allLists);
76100
+ if (!lists) {
76101
+ return null;
76102
+ }
76103
+ if (skipMatches) {
76104
+ return new ListCollection(lists.lists.filter((list) => !skipMatches.has(list.fieldRef)));
76105
+ } else {
76106
+ return lists;
76107
+ }
76108
+ }
76109
+ getLists(listName, id, allLists) {
76099
76110
  const matches = this.lists.get(listName);
76100
76111
  if (!matches || matches.size === 0) {
76101
76112
  return null;
@@ -76217,6 +76228,9 @@ var List = class {
76217
76228
  this.manager = manager;
76218
76229
  this.abstract = abstract;
76219
76230
  }
76231
+ get fieldRef() {
76232
+ return `${this.recordID}.${this.key}`;
76233
+ }
76220
76234
  when(when) {
76221
76235
  return this.manager.lists.get(this.name).get(this.recordID).when(when);
76222
76236
  }
@@ -77361,8 +77375,8 @@ var Cache = class {
77361
77375
  variables
77362
77376
  );
77363
77377
  }
77364
- list(name, parentID, allLists) {
77365
- const handler = this._internal_unstable.lists.get(name, parentID, allLists);
77378
+ list(name, parentID, allLists, skipMatches) {
77379
+ const handler = this._internal_unstable.lists.get(name, parentID, allLists, skipMatches);
77366
77380
  if (!handler) {
77367
77381
  throw new Error(
77368
77382
  `Cannot find list with name: ${name}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
@@ -77777,6 +77791,7 @@ var CacheInternal = class {
77777
77791
  });
77778
77792
  }
77779
77793
  }
77794
+ const processedOperations = /* @__PURE__ */ new Set();
77780
77795
  for (const operation of operations || []) {
77781
77796
  let parentID;
77782
77797
  if (operation.parentID) {
@@ -77796,7 +77811,12 @@ var CacheInternal = class {
77796
77811
  const targets = Array.isArray(value) ? value : [value];
77797
77812
  for (const target of targets) {
77798
77813
  if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
77799
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
77814
+ this.cache.list(
77815
+ operation.list,
77816
+ parentID,
77817
+ operation.target === "all",
77818
+ processedOperations
77819
+ ).when(operation.when).addToList(
77800
77820
  fieldSelection,
77801
77821
  target,
77802
77822
  variables,
@@ -77804,7 +77824,12 @@ var CacheInternal = class {
77804
77824
  layer
77805
77825
  );
77806
77826
  } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
77807
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
77827
+ this.cache.list(
77828
+ operation.list,
77829
+ parentID,
77830
+ operation.target === "all",
77831
+ processedOperations
77832
+ ).when(operation.when).toggleElement({
77808
77833
  selection: fieldSelection,
77809
77834
  data: target,
77810
77835
  variables,
@@ -77812,7 +77837,12 @@ var CacheInternal = class {
77812
77837
  layer
77813
77838
  });
77814
77839
  } else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
77815
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
77840
+ this.cache.list(
77841
+ operation.list,
77842
+ parentID,
77843
+ operation.target === "all",
77844
+ processedOperations
77845
+ ).when(operation.when).remove(target, variables, layer);
77816
77846
  } else if (operation.action === "delete" && operation.type && target) {
77817
77847
  const targetID = this.id(operation.type, target);
77818
77848
  if (!targetID) {
@@ -77824,6 +77854,16 @@ var CacheInternal = class {
77824
77854
  this.cache.delete(targetID, layer);
77825
77855
  }
77826
77856
  }
77857
+ if (operation.list) {
77858
+ const matchingLists = this.cache.list(
77859
+ operation.list,
77860
+ parentID,
77861
+ operation.target === "all"
77862
+ );
77863
+ for (const list of matchingLists.lists) {
77864
+ processedOperations.add(list.fieldRef);
77865
+ }
77866
+ }
77827
77867
  }
77828
77868
  }
77829
77869
  return toNotify;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-react",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
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": "^4.28.1",
45
45
  "use-deep-compare-effect": "^1.8.1",
46
- "houdini": "^1.4.0"
46
+ "houdini": "^1.4.1"
47
47
  },
48
48
  "files": [
49
49
  "build"