houdini-svelte 1.2.2 → 1.2.3

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.
@@ -93864,10 +93864,10 @@ var ListManager = class {
93864
93864
  this.lists.get(list.name).get(parentID).lists.push(handler);
93865
93865
  this.listsByField.get(parentID).get(list.key).push(handler);
93866
93866
  }
93867
- removeIDFromAllLists(id2) {
93867
+ removeIDFromAllLists(id2, layer) {
93868
93868
  for (const fieldMap of this.lists.values()) {
93869
93869
  for (const list of fieldMap.values()) {
93870
- list.removeID(id2);
93870
+ list.removeID(id2, void 0, layer);
93871
93871
  }
93872
93872
  }
93873
93873
  }
@@ -94024,7 +94024,7 @@ var List = class {
94024
94024
  layer: layer?.id
94025
94025
  });
94026
94026
  }
94027
- removeID(id2, variables = {}) {
94027
+ removeID(id2, variables = {}, layer) {
94028
94028
  if (!this.validateWhen()) {
94029
94029
  return;
94030
94030
  }
@@ -94071,7 +94071,7 @@ var List = class {
94071
94071
  subscribers.map((sub) => sub[0]),
94072
94072
  variables
94073
94073
  );
94074
- this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
94074
+ this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
94075
94075
  for (const [spec] of subscribers) {
94076
94076
  spec.set(
94077
94077
  this.cache._internal_unstable.getSelection({
@@ -94084,12 +94084,12 @@ var List = class {
94084
94084
  }
94085
94085
  return true;
94086
94086
  }
94087
- remove(data2, variables = {}) {
94087
+ remove(data2, variables = {}, layer) {
94088
94088
  const targetID = this.cache._internal_unstable.id(this.listType(data2), data2);
94089
94089
  if (!targetID) {
94090
94090
  return;
94091
94091
  }
94092
- return this.removeID(targetID, variables);
94092
+ return this.removeID(targetID, variables, layer);
94093
94093
  }
94094
94094
  listType(data2) {
94095
94095
  return data2.__typename || this.type;
@@ -94121,7 +94121,7 @@ var List = class {
94121
94121
  layer,
94122
94122
  where
94123
94123
  }) {
94124
- if (!this.remove(data2, variables)) {
94124
+ if (!this.remove(data2, variables, layer)) {
94125
94125
  this.addToList(selection, data2, variables, where, layer);
94126
94126
  }
94127
94127
  }
@@ -94254,7 +94254,7 @@ var StaleManager = class {
94254
94254
  };
94255
94255
  var InMemoryStorage = class {
94256
94256
  data;
94257
- idCount = 0;
94257
+ idCount = 1;
94258
94258
  rank = 0;
94259
94259
  constructor() {
94260
94260
  this.data = [];
@@ -94274,11 +94274,11 @@ var InMemoryStorage = class {
94274
94274
  insert(id2, field, location, target) {
94275
94275
  return this.topLayer.insert(id2, field, location, target);
94276
94276
  }
94277
- remove(id2, field, target) {
94278
- return this.topLayer.remove(id2, field, target);
94277
+ remove(id2, field, target, layerToUser = this.topLayer) {
94278
+ return layerToUser.remove(id2, field, target);
94279
94279
  }
94280
- delete(id2) {
94281
- return this.topLayer.delete(id2);
94280
+ delete(id2, layerToUser = this.topLayer) {
94281
+ return layerToUser.delete(id2);
94282
94282
  }
94283
94283
  deleteField(id2, field) {
94284
94284
  return this.topLayer.deleteField(id2, field);
@@ -94646,6 +94646,9 @@ var InMemorySubscriptions = class {
94646
94646
  subscribers = {};
94647
94647
  referenceCounts = {};
94648
94648
  keyVersions = {};
94649
+ activeFields(parent2) {
94650
+ return Object.keys(this.subscribers[parent2] || {});
94651
+ }
94649
94652
  add({
94650
94653
  parent: parent2,
94651
94654
  spec,
@@ -94912,20 +94915,7 @@ var Cache = class {
94912
94915
  }) {
94913
94916
  const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
94914
94917
  const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
94915
- const notified = [];
94916
- for (const spec of subscribers.concat(notifySubscribers)) {
94917
- if (!notified.includes(spec.set)) {
94918
- notified.push(spec.set);
94919
- spec.set(
94920
- this._internal_unstable.getSelection({
94921
- parent: spec.parentID || rootID,
94922
- selection: spec.selection,
94923
- variables: spec.variables?.() || {},
94924
- ignoreMasking: false
94925
- }).data
94926
- );
94927
- }
94928
- }
94918
+ this.#notifySubscribers(subscribers.concat(notifySubscribers));
94929
94919
  return subscribers;
94930
94920
  }
94931
94921
  read(...args) {
@@ -94964,10 +94954,10 @@ var Cache = class {
94964
94954
  }
94965
94955
  return handler;
94966
94956
  }
94967
- delete(id2) {
94957
+ delete(id2, layer) {
94968
94958
  this._internal_unstable.subscriptions.removeAllSubscribers(id2);
94969
- this._internal_unstable.lists.removeIDFromAllLists(id2);
94970
- this._internal_unstable.storage.delete(id2);
94959
+ this._internal_unstable.lists.removeIDFromAllLists(id2, layer);
94960
+ this._internal_unstable.storage.delete(id2, layer);
94971
94961
  }
94972
94962
  setConfig(config4) {
94973
94963
  this._internal_unstable.setConfig(config4);
@@ -94999,6 +94989,70 @@ var Cache = class {
94999
94989
  config() {
95000
94990
  return this._internal_unstable.config;
95001
94991
  }
94992
+ clearLayer(layerID) {
94993
+ const layer = this._internal_unstable.storage.getLayer(layerID);
94994
+ if (!layer) {
94995
+ throw new Error("Cannot find layer with id: " + layerID);
94996
+ }
94997
+ const toNotify = [];
94998
+ const allFields = [];
94999
+ for (const target of [layer.fields, layer.links]) {
95000
+ for (const [id2, fields] of Object.entries(target)) {
95001
+ allFields.push(
95002
+ ...Object.entries(fields).map(([field, value2]) => ({ id: id2, field, value: value2 }))
95003
+ );
95004
+ }
95005
+ }
95006
+ const displayFields = [];
95007
+ for (const pair of allFields) {
95008
+ const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
95009
+ if (!displayLayers.includes(layerID)) {
95010
+ continue;
95011
+ }
95012
+ displayFields.push(pair);
95013
+ }
95014
+ for (const [id2, operation] of Object.entries(layer.operations)) {
95015
+ if (operation.deleted) {
95016
+ displayFields.push(
95017
+ ...this._internal_unstable.subscriptions.activeFields(id2).map((field) => ({ id: id2, field }))
95018
+ );
95019
+ }
95020
+ const fields = Object.keys(operation.fields ?? {});
95021
+ if (fields.length > 0) {
95022
+ displayFields.push(...fields.map((field) => ({ id: id2, field })));
95023
+ }
95024
+ }
95025
+ layer.clear();
95026
+ for (const display of displayFields) {
95027
+ const { field, id: id2 } = display;
95028
+ const notify = !("value" in display) || this._internal_unstable.storage.get(id2, field).value !== display.value;
95029
+ if (notify) {
95030
+ toNotify.push(
95031
+ ...this._internal_unstable.subscriptions.get(id2, field).map((sub) => sub[0])
95032
+ );
95033
+ }
95034
+ }
95035
+ this.#notifySubscribers(toNotify);
95036
+ }
95037
+ #notifySubscribers(subs) {
95038
+ if (subs.length === 0) {
95039
+ return;
95040
+ }
95041
+ const notified = [];
95042
+ for (const spec of subs) {
95043
+ if (!notified.includes(spec.set)) {
95044
+ notified.push(spec.set);
95045
+ spec.set(
95046
+ this._internal_unstable.getSelection({
95047
+ parent: spec.parentID || rootID,
95048
+ selection: spec.selection,
95049
+ variables: spec.variables?.() || {},
95050
+ ignoreMasking: false
95051
+ }).data
95052
+ );
95053
+ }
95054
+ }
95055
+ }
95002
95056
  };
95003
95057
  var CacheInternal = class {
95004
95058
  _disabled = false;
@@ -95286,8 +95340,16 @@ var CacheInternal = class {
95286
95340
  operation.position || "last",
95287
95341
  layer
95288
95342
  );
95343
+ } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
95344
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
95345
+ selection: fieldSelection,
95346
+ data: target,
95347
+ variables,
95348
+ where: operation.position || "last",
95349
+ layer
95350
+ });
95289
95351
  } else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
95290
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
95352
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
95291
95353
  } else if (operation.action === "delete" && operation.type) {
95292
95354
  if (typeof target !== "string") {
95293
95355
  throw new Error("Cannot delete a record with a non-string ID");
@@ -95296,15 +95358,7 @@ var CacheInternal = class {
95296
95358
  if (!targetID) {
95297
95359
  continue;
95298
95360
  }
95299
- this.cache.delete(targetID);
95300
- } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
95301
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
95302
- selection: fieldSelection,
95303
- data: target,
95304
- variables,
95305
- where: operation.position || "last",
95306
- layer
95307
- });
95361
+ this.cache.delete(targetID, layer);
95308
95362
  }
95309
95363
  }
95310
95364
  }
@@ -95827,7 +95881,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
95827
95881
  var mutation = documentPlugin(ArtifactKind.Mutation, () => {
95828
95882
  return {
95829
95883
  async start(ctx, { next, marshalVariables: marshalVariables2 }) {
95830
- const layer = cache_default._internal_unstable.storage.createLayer(true);
95884
+ const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
95831
95885
  const optimisticResponse = ctx.stuff.optimisticResponse;
95832
95886
  let toNotify = [];
95833
95887
  if (optimisticResponse) {
@@ -95838,25 +95892,29 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
95838
95892
  data: optimisticResponse
95839
95893
  }),
95840
95894
  variables: marshalVariables2(ctx),
95841
- layer: layer.id
95895
+ layer: layerOptimistic.id
95842
95896
  });
95843
95897
  }
95844
95898
  ctx.cacheParams = {
95845
95899
  ...ctx.cacheParams,
95846
- layer,
95900
+ layer: layerOptimistic,
95847
95901
  notifySubscribers: toNotify,
95848
95902
  forceNotify: true
95849
95903
  };
95850
95904
  next(ctx);
95851
95905
  },
95852
95906
  afterNetwork(ctx, { resolve: resolve22 }) {
95853
- ctx.cacheParams?.layer?.clear();
95907
+ if (ctx.cacheParams?.layer) {
95908
+ cache_default.clearLayer(ctx.cacheParams.layer.id);
95909
+ }
95854
95910
  resolve22(ctx);
95855
95911
  },
95856
95912
  end(ctx, { resolve: resolve22, value: value2 }) {
95857
95913
  const hasErrors = value2.errors && value2.errors.length > 0;
95858
95914
  if (hasErrors) {
95859
- ctx.cacheParams?.layer?.clear();
95915
+ if (ctx.cacheParams?.layer) {
95916
+ cache_default.clearLayer(ctx.cacheParams.layer.id);
95917
+ }
95860
95918
  }
95861
95919
  if (ctx.cacheParams?.layer) {
95862
95920
  cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
@@ -95866,7 +95924,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
95866
95924
  catch(ctx, { error: error2 }) {
95867
95925
  if (ctx.cacheParams?.layer) {
95868
95926
  const { layer } = ctx.cacheParams;
95869
- layer.clear();
95927
+ cache_default.clearLayer(layer.id);
95870
95928
  cache_default._internal_unstable.storage.resolveLayer(layer.id);
95871
95929
  }
95872
95930
  throw error2;
@@ -187544,10 +187602,10 @@ var ListManager2 = class {
187544
187602
  this.lists.get(list.name).get(parentID).lists.push(handler);
187545
187603
  this.listsByField.get(parentID).get(list.key).push(handler);
187546
187604
  }
187547
- removeIDFromAllLists(id2) {
187605
+ removeIDFromAllLists(id2, layer) {
187548
187606
  for (const fieldMap of this.lists.values()) {
187549
187607
  for (const list of fieldMap.values()) {
187550
- list.removeID(id2);
187608
+ list.removeID(id2, void 0, layer);
187551
187609
  }
187552
187610
  }
187553
187611
  }
@@ -187704,7 +187762,7 @@ var List3 = class {
187704
187762
  layer: layer?.id
187705
187763
  });
187706
187764
  }
187707
- removeID(id2, variables = {}) {
187765
+ removeID(id2, variables = {}, layer) {
187708
187766
  if (!this.validateWhen()) {
187709
187767
  return;
187710
187768
  }
@@ -187751,7 +187809,7 @@ var List3 = class {
187751
187809
  subscribers.map((sub) => sub[0]),
187752
187810
  variables
187753
187811
  );
187754
- this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
187812
+ this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
187755
187813
  for (const [spec] of subscribers) {
187756
187814
  spec.set(
187757
187815
  this.cache._internal_unstable.getSelection({
@@ -187764,12 +187822,12 @@ var List3 = class {
187764
187822
  }
187765
187823
  return true;
187766
187824
  }
187767
- remove(data2, variables = {}) {
187825
+ remove(data2, variables = {}, layer) {
187768
187826
  const targetID = this.cache._internal_unstable.id(this.listType(data2), data2);
187769
187827
  if (!targetID) {
187770
187828
  return;
187771
187829
  }
187772
- return this.removeID(targetID, variables);
187830
+ return this.removeID(targetID, variables, layer);
187773
187831
  }
187774
187832
  listType(data2) {
187775
187833
  return data2.__typename || this.type;
@@ -187801,7 +187859,7 @@ var List3 = class {
187801
187859
  layer,
187802
187860
  where
187803
187861
  }) {
187804
- if (!this.remove(data2, variables)) {
187862
+ if (!this.remove(data2, variables, layer)) {
187805
187863
  this.addToList(selection, data2, variables, where, layer);
187806
187864
  }
187807
187865
  }
@@ -187934,7 +187992,7 @@ var StaleManager2 = class {
187934
187992
  };
187935
187993
  var InMemoryStorage2 = class {
187936
187994
  data;
187937
- idCount = 0;
187995
+ idCount = 1;
187938
187996
  rank = 0;
187939
187997
  constructor() {
187940
187998
  this.data = [];
@@ -187954,11 +188012,11 @@ var InMemoryStorage2 = class {
187954
188012
  insert(id2, field, location, target) {
187955
188013
  return this.topLayer.insert(id2, field, location, target);
187956
188014
  }
187957
- remove(id2, field, target) {
187958
- return this.topLayer.remove(id2, field, target);
188015
+ remove(id2, field, target, layerToUser = this.topLayer) {
188016
+ return layerToUser.remove(id2, field, target);
187959
188017
  }
187960
- delete(id2) {
187961
- return this.topLayer.delete(id2);
188018
+ delete(id2, layerToUser = this.topLayer) {
188019
+ return layerToUser.delete(id2);
187962
188020
  }
187963
188021
  deleteField(id2, field) {
187964
188022
  return this.topLayer.deleteField(id2, field);
@@ -188326,6 +188384,9 @@ var InMemorySubscriptions2 = class {
188326
188384
  subscribers = {};
188327
188385
  referenceCounts = {};
188328
188386
  keyVersions = {};
188387
+ activeFields(parent2) {
188388
+ return Object.keys(this.subscribers[parent2] || {});
188389
+ }
188329
188390
  add({
188330
188391
  parent: parent2,
188331
188392
  spec,
@@ -188592,20 +188653,7 @@ var Cache2 = class {
188592
188653
  }) {
188593
188654
  const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
188594
188655
  const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
188595
- const notified = [];
188596
- for (const spec of subscribers.concat(notifySubscribers)) {
188597
- if (!notified.includes(spec.set)) {
188598
- notified.push(spec.set);
188599
- spec.set(
188600
- this._internal_unstable.getSelection({
188601
- parent: spec.parentID || rootID2,
188602
- selection: spec.selection,
188603
- variables: spec.variables?.() || {},
188604
- ignoreMasking: false
188605
- }).data
188606
- );
188607
- }
188608
- }
188656
+ this.#notifySubscribers(subscribers.concat(notifySubscribers));
188609
188657
  return subscribers;
188610
188658
  }
188611
188659
  read(...args) {
@@ -188644,10 +188692,10 @@ var Cache2 = class {
188644
188692
  }
188645
188693
  return handler;
188646
188694
  }
188647
- delete(id2) {
188695
+ delete(id2, layer) {
188648
188696
  this._internal_unstable.subscriptions.removeAllSubscribers(id2);
188649
- this._internal_unstable.lists.removeIDFromAllLists(id2);
188650
- this._internal_unstable.storage.delete(id2);
188697
+ this._internal_unstable.lists.removeIDFromAllLists(id2, layer);
188698
+ this._internal_unstable.storage.delete(id2, layer);
188651
188699
  }
188652
188700
  setConfig(config4) {
188653
188701
  this._internal_unstable.setConfig(config4);
@@ -188679,6 +188727,70 @@ var Cache2 = class {
188679
188727
  config() {
188680
188728
  return this._internal_unstable.config;
188681
188729
  }
188730
+ clearLayer(layerID) {
188731
+ const layer = this._internal_unstable.storage.getLayer(layerID);
188732
+ if (!layer) {
188733
+ throw new Error("Cannot find layer with id: " + layerID);
188734
+ }
188735
+ const toNotify = [];
188736
+ const allFields = [];
188737
+ for (const target of [layer.fields, layer.links]) {
188738
+ for (const [id2, fields] of Object.entries(target)) {
188739
+ allFields.push(
188740
+ ...Object.entries(fields).map(([field, value2]) => ({ id: id2, field, value: value2 }))
188741
+ );
188742
+ }
188743
+ }
188744
+ const displayFields = [];
188745
+ for (const pair of allFields) {
188746
+ const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
188747
+ if (!displayLayers.includes(layerID)) {
188748
+ continue;
188749
+ }
188750
+ displayFields.push(pair);
188751
+ }
188752
+ for (const [id2, operation] of Object.entries(layer.operations)) {
188753
+ if (operation.deleted) {
188754
+ displayFields.push(
188755
+ ...this._internal_unstable.subscriptions.activeFields(id2).map((field) => ({ id: id2, field }))
188756
+ );
188757
+ }
188758
+ const fields = Object.keys(operation.fields ?? {});
188759
+ if (fields.length > 0) {
188760
+ displayFields.push(...fields.map((field) => ({ id: id2, field })));
188761
+ }
188762
+ }
188763
+ layer.clear();
188764
+ for (const display of displayFields) {
188765
+ const { field, id: id2 } = display;
188766
+ const notify = !("value" in display) || this._internal_unstable.storage.get(id2, field).value !== display.value;
188767
+ if (notify) {
188768
+ toNotify.push(
188769
+ ...this._internal_unstable.subscriptions.get(id2, field).map((sub) => sub[0])
188770
+ );
188771
+ }
188772
+ }
188773
+ this.#notifySubscribers(toNotify);
188774
+ }
188775
+ #notifySubscribers(subs) {
188776
+ if (subs.length === 0) {
188777
+ return;
188778
+ }
188779
+ const notified = [];
188780
+ for (const spec of subs) {
188781
+ if (!notified.includes(spec.set)) {
188782
+ notified.push(spec.set);
188783
+ spec.set(
188784
+ this._internal_unstable.getSelection({
188785
+ parent: spec.parentID || rootID2,
188786
+ selection: spec.selection,
188787
+ variables: spec.variables?.() || {},
188788
+ ignoreMasking: false
188789
+ }).data
188790
+ );
188791
+ }
188792
+ }
188793
+ }
188682
188794
  };
188683
188795
  var CacheInternal2 = class {
188684
188796
  _disabled = false;
@@ -188966,8 +189078,16 @@ var CacheInternal2 = class {
188966
189078
  operation.position || "last",
188967
189079
  layer
188968
189080
  );
189081
+ } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
189082
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
189083
+ selection: fieldSelection,
189084
+ data: target,
189085
+ variables,
189086
+ where: operation.position || "last",
189087
+ layer
189088
+ });
188969
189089
  } else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
188970
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
189090
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
188971
189091
  } else if (operation.action === "delete" && operation.type) {
188972
189092
  if (typeof target !== "string") {
188973
189093
  throw new Error("Cannot delete a record with a non-string ID");
@@ -188976,15 +189096,7 @@ var CacheInternal2 = class {
188976
189096
  if (!targetID) {
188977
189097
  continue;
188978
189098
  }
188979
- this.cache.delete(targetID);
188980
- } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
188981
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
188982
- selection: fieldSelection,
188983
- data: target,
188984
- variables,
188985
- where: operation.position || "last",
188986
- layer
188987
- });
189099
+ this.cache.delete(targetID, layer);
188988
189100
  }
188989
189101
  }
188990
189102
  }
@@ -189507,7 +189619,7 @@ var fragment3 = documentPlugin2(ArtifactKind2.Fragment, function() {
189507
189619
  var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
189508
189620
  return {
189509
189621
  async start(ctx, { next, marshalVariables }) {
189510
- const layer = cache_default2._internal_unstable.storage.createLayer(true);
189622
+ const layerOptimistic = cache_default2._internal_unstable.storage.createLayer(true);
189511
189623
  const optimisticResponse = ctx.stuff.optimisticResponse;
189512
189624
  let toNotify = [];
189513
189625
  if (optimisticResponse) {
@@ -189518,25 +189630,29 @@ var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
189518
189630
  data: optimisticResponse
189519
189631
  }),
189520
189632
  variables: marshalVariables(ctx),
189521
- layer: layer.id
189633
+ layer: layerOptimistic.id
189522
189634
  });
189523
189635
  }
189524
189636
  ctx.cacheParams = {
189525
189637
  ...ctx.cacheParams,
189526
- layer,
189638
+ layer: layerOptimistic,
189527
189639
  notifySubscribers: toNotify,
189528
189640
  forceNotify: true
189529
189641
  };
189530
189642
  next(ctx);
189531
189643
  },
189532
189644
  afterNetwork(ctx, { resolve: resolve22 }) {
189533
- ctx.cacheParams?.layer?.clear();
189645
+ if (ctx.cacheParams?.layer) {
189646
+ cache_default2.clearLayer(ctx.cacheParams.layer.id);
189647
+ }
189534
189648
  resolve22(ctx);
189535
189649
  },
189536
189650
  end(ctx, { resolve: resolve22, value: value2 }) {
189537
189651
  const hasErrors = value2.errors && value2.errors.length > 0;
189538
189652
  if (hasErrors) {
189539
- ctx.cacheParams?.layer?.clear();
189653
+ if (ctx.cacheParams?.layer) {
189654
+ cache_default2.clearLayer(ctx.cacheParams.layer.id);
189655
+ }
189540
189656
  }
189541
189657
  if (ctx.cacheParams?.layer) {
189542
189658
  cache_default2._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
@@ -189546,7 +189662,7 @@ var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
189546
189662
  catch(ctx, { error: error2 }) {
189547
189663
  if (ctx.cacheParams?.layer) {
189548
189664
  const { layer } = ctx.cacheParams;
189549
- layer.clear();
189665
+ cache_default2.clearLayer(layer.id);
189550
189666
  cache_default2._internal_unstable.storage.resolveLayer(layer.id);
189551
189667
  }
189552
189668
  throw error2;