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.
@@ -93871,10 +93871,10 @@ var ListManager = class {
93871
93871
  this.lists.get(list.name).get(parentID).lists.push(handler);
93872
93872
  this.listsByField.get(parentID).get(list.key).push(handler);
93873
93873
  }
93874
- removeIDFromAllLists(id2) {
93874
+ removeIDFromAllLists(id2, layer) {
93875
93875
  for (const fieldMap of this.lists.values()) {
93876
93876
  for (const list of fieldMap.values()) {
93877
- list.removeID(id2);
93877
+ list.removeID(id2, void 0, layer);
93878
93878
  }
93879
93879
  }
93880
93880
  }
@@ -94031,7 +94031,7 @@ var List = class {
94031
94031
  layer: layer?.id
94032
94032
  });
94033
94033
  }
94034
- removeID(id2, variables = {}) {
94034
+ removeID(id2, variables = {}, layer) {
94035
94035
  if (!this.validateWhen()) {
94036
94036
  return;
94037
94037
  }
@@ -94078,7 +94078,7 @@ var List = class {
94078
94078
  subscribers.map((sub) => sub[0]),
94079
94079
  variables
94080
94080
  );
94081
- this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
94081
+ this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
94082
94082
  for (const [spec] of subscribers) {
94083
94083
  spec.set(
94084
94084
  this.cache._internal_unstable.getSelection({
@@ -94091,12 +94091,12 @@ var List = class {
94091
94091
  }
94092
94092
  return true;
94093
94093
  }
94094
- remove(data2, variables = {}) {
94094
+ remove(data2, variables = {}, layer) {
94095
94095
  const targetID = this.cache._internal_unstable.id(this.listType(data2), data2);
94096
94096
  if (!targetID) {
94097
94097
  return;
94098
94098
  }
94099
- return this.removeID(targetID, variables);
94099
+ return this.removeID(targetID, variables, layer);
94100
94100
  }
94101
94101
  listType(data2) {
94102
94102
  return data2.__typename || this.type;
@@ -94128,7 +94128,7 @@ var List = class {
94128
94128
  layer,
94129
94129
  where
94130
94130
  }) {
94131
- if (!this.remove(data2, variables)) {
94131
+ if (!this.remove(data2, variables, layer)) {
94132
94132
  this.addToList(selection, data2, variables, where, layer);
94133
94133
  }
94134
94134
  }
@@ -94261,7 +94261,7 @@ var StaleManager = class {
94261
94261
  };
94262
94262
  var InMemoryStorage = class {
94263
94263
  data;
94264
- idCount = 0;
94264
+ idCount = 1;
94265
94265
  rank = 0;
94266
94266
  constructor() {
94267
94267
  this.data = [];
@@ -94281,11 +94281,11 @@ var InMemoryStorage = class {
94281
94281
  insert(id2, field, location, target) {
94282
94282
  return this.topLayer.insert(id2, field, location, target);
94283
94283
  }
94284
- remove(id2, field, target) {
94285
- return this.topLayer.remove(id2, field, target);
94284
+ remove(id2, field, target, layerToUser = this.topLayer) {
94285
+ return layerToUser.remove(id2, field, target);
94286
94286
  }
94287
- delete(id2) {
94288
- return this.topLayer.delete(id2);
94287
+ delete(id2, layerToUser = this.topLayer) {
94288
+ return layerToUser.delete(id2);
94289
94289
  }
94290
94290
  deleteField(id2, field) {
94291
94291
  return this.topLayer.deleteField(id2, field);
@@ -94653,6 +94653,9 @@ var InMemorySubscriptions = class {
94653
94653
  subscribers = {};
94654
94654
  referenceCounts = {};
94655
94655
  keyVersions = {};
94656
+ activeFields(parent2) {
94657
+ return Object.keys(this.subscribers[parent2] || {});
94658
+ }
94656
94659
  add({
94657
94660
  parent: parent2,
94658
94661
  spec,
@@ -94919,20 +94922,7 @@ var Cache = class {
94919
94922
  }) {
94920
94923
  const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
94921
94924
  const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
94922
- const notified = [];
94923
- for (const spec of subscribers.concat(notifySubscribers)) {
94924
- if (!notified.includes(spec.set)) {
94925
- notified.push(spec.set);
94926
- spec.set(
94927
- this._internal_unstable.getSelection({
94928
- parent: spec.parentID || rootID,
94929
- selection: spec.selection,
94930
- variables: spec.variables?.() || {},
94931
- ignoreMasking: false
94932
- }).data
94933
- );
94934
- }
94935
- }
94925
+ this.#notifySubscribers(subscribers.concat(notifySubscribers));
94936
94926
  return subscribers;
94937
94927
  }
94938
94928
  read(...args) {
@@ -94971,10 +94961,10 @@ var Cache = class {
94971
94961
  }
94972
94962
  return handler;
94973
94963
  }
94974
- delete(id2) {
94964
+ delete(id2, layer) {
94975
94965
  this._internal_unstable.subscriptions.removeAllSubscribers(id2);
94976
- this._internal_unstable.lists.removeIDFromAllLists(id2);
94977
- this._internal_unstable.storage.delete(id2);
94966
+ this._internal_unstable.lists.removeIDFromAllLists(id2, layer);
94967
+ this._internal_unstable.storage.delete(id2, layer);
94978
94968
  }
94979
94969
  setConfig(config4) {
94980
94970
  this._internal_unstable.setConfig(config4);
@@ -95006,6 +94996,70 @@ var Cache = class {
95006
94996
  config() {
95007
94997
  return this._internal_unstable.config;
95008
94998
  }
94999
+ clearLayer(layerID) {
95000
+ const layer = this._internal_unstable.storage.getLayer(layerID);
95001
+ if (!layer) {
95002
+ throw new Error("Cannot find layer with id: " + layerID);
95003
+ }
95004
+ const toNotify = [];
95005
+ const allFields = [];
95006
+ for (const target of [layer.fields, layer.links]) {
95007
+ for (const [id2, fields] of Object.entries(target)) {
95008
+ allFields.push(
95009
+ ...Object.entries(fields).map(([field, value2]) => ({ id: id2, field, value: value2 }))
95010
+ );
95011
+ }
95012
+ }
95013
+ const displayFields = [];
95014
+ for (const pair of allFields) {
95015
+ const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
95016
+ if (!displayLayers.includes(layerID)) {
95017
+ continue;
95018
+ }
95019
+ displayFields.push(pair);
95020
+ }
95021
+ for (const [id2, operation] of Object.entries(layer.operations)) {
95022
+ if (operation.deleted) {
95023
+ displayFields.push(
95024
+ ...this._internal_unstable.subscriptions.activeFields(id2).map((field) => ({ id: id2, field }))
95025
+ );
95026
+ }
95027
+ const fields = Object.keys(operation.fields ?? {});
95028
+ if (fields.length > 0) {
95029
+ displayFields.push(...fields.map((field) => ({ id: id2, field })));
95030
+ }
95031
+ }
95032
+ layer.clear();
95033
+ for (const display of displayFields) {
95034
+ const { field, id: id2 } = display;
95035
+ const notify = !("value" in display) || this._internal_unstable.storage.get(id2, field).value !== display.value;
95036
+ if (notify) {
95037
+ toNotify.push(
95038
+ ...this._internal_unstable.subscriptions.get(id2, field).map((sub) => sub[0])
95039
+ );
95040
+ }
95041
+ }
95042
+ this.#notifySubscribers(toNotify);
95043
+ }
95044
+ #notifySubscribers(subs) {
95045
+ if (subs.length === 0) {
95046
+ return;
95047
+ }
95048
+ const notified = [];
95049
+ for (const spec of subs) {
95050
+ if (!notified.includes(spec.set)) {
95051
+ notified.push(spec.set);
95052
+ spec.set(
95053
+ this._internal_unstable.getSelection({
95054
+ parent: spec.parentID || rootID,
95055
+ selection: spec.selection,
95056
+ variables: spec.variables?.() || {},
95057
+ ignoreMasking: false
95058
+ }).data
95059
+ );
95060
+ }
95061
+ }
95062
+ }
95009
95063
  };
95010
95064
  var CacheInternal = class {
95011
95065
  _disabled = false;
@@ -95293,8 +95347,16 @@ var CacheInternal = class {
95293
95347
  operation.position || "last",
95294
95348
  layer
95295
95349
  );
95350
+ } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
95351
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
95352
+ selection: fieldSelection,
95353
+ data: target,
95354
+ variables,
95355
+ where: operation.position || "last",
95356
+ layer
95357
+ });
95296
95358
  } else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
95297
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
95359
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
95298
95360
  } else if (operation.action === "delete" && operation.type) {
95299
95361
  if (typeof target !== "string") {
95300
95362
  throw new Error("Cannot delete a record with a non-string ID");
@@ -95303,15 +95365,7 @@ var CacheInternal = class {
95303
95365
  if (!targetID) {
95304
95366
  continue;
95305
95367
  }
95306
- this.cache.delete(targetID);
95307
- } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
95308
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
95309
- selection: fieldSelection,
95310
- data: target,
95311
- variables,
95312
- where: operation.position || "last",
95313
- layer
95314
- });
95368
+ this.cache.delete(targetID, layer);
95315
95369
  }
95316
95370
  }
95317
95371
  }
@@ -95834,7 +95888,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
95834
95888
  var mutation = documentPlugin(ArtifactKind.Mutation, () => {
95835
95889
  return {
95836
95890
  async start(ctx, { next, marshalVariables: marshalVariables2 }) {
95837
- const layer = cache_default._internal_unstable.storage.createLayer(true);
95891
+ const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
95838
95892
  const optimisticResponse = ctx.stuff.optimisticResponse;
95839
95893
  let toNotify = [];
95840
95894
  if (optimisticResponse) {
@@ -95845,25 +95899,29 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
95845
95899
  data: optimisticResponse
95846
95900
  }),
95847
95901
  variables: marshalVariables2(ctx),
95848
- layer: layer.id
95902
+ layer: layerOptimistic.id
95849
95903
  });
95850
95904
  }
95851
95905
  ctx.cacheParams = {
95852
95906
  ...ctx.cacheParams,
95853
- layer,
95907
+ layer: layerOptimistic,
95854
95908
  notifySubscribers: toNotify,
95855
95909
  forceNotify: true
95856
95910
  };
95857
95911
  next(ctx);
95858
95912
  },
95859
95913
  afterNetwork(ctx, { resolve: resolve22 }) {
95860
- ctx.cacheParams?.layer?.clear();
95914
+ if (ctx.cacheParams?.layer) {
95915
+ cache_default.clearLayer(ctx.cacheParams.layer.id);
95916
+ }
95861
95917
  resolve22(ctx);
95862
95918
  },
95863
95919
  end(ctx, { resolve: resolve22, value: value2 }) {
95864
95920
  const hasErrors = value2.errors && value2.errors.length > 0;
95865
95921
  if (hasErrors) {
95866
- ctx.cacheParams?.layer?.clear();
95922
+ if (ctx.cacheParams?.layer) {
95923
+ cache_default.clearLayer(ctx.cacheParams.layer.id);
95924
+ }
95867
95925
  }
95868
95926
  if (ctx.cacheParams?.layer) {
95869
95927
  cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
@@ -95873,7 +95931,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
95873
95931
  catch(ctx, { error: error2 }) {
95874
95932
  if (ctx.cacheParams?.layer) {
95875
95933
  const { layer } = ctx.cacheParams;
95876
- layer.clear();
95934
+ cache_default.clearLayer(layer.id);
95877
95935
  cache_default._internal_unstable.storage.resolveLayer(layer.id);
95878
95936
  }
95879
95937
  throw error2;
@@ -187552,10 +187610,10 @@ var ListManager2 = class {
187552
187610
  this.lists.get(list.name).get(parentID).lists.push(handler);
187553
187611
  this.listsByField.get(parentID).get(list.key).push(handler);
187554
187612
  }
187555
- removeIDFromAllLists(id2) {
187613
+ removeIDFromAllLists(id2, layer) {
187556
187614
  for (const fieldMap of this.lists.values()) {
187557
187615
  for (const list of fieldMap.values()) {
187558
- list.removeID(id2);
187616
+ list.removeID(id2, void 0, layer);
187559
187617
  }
187560
187618
  }
187561
187619
  }
@@ -187712,7 +187770,7 @@ var List3 = class {
187712
187770
  layer: layer?.id
187713
187771
  });
187714
187772
  }
187715
- removeID(id2, variables = {}) {
187773
+ removeID(id2, variables = {}, layer) {
187716
187774
  if (!this.validateWhen()) {
187717
187775
  return;
187718
187776
  }
@@ -187759,7 +187817,7 @@ var List3 = class {
187759
187817
  subscribers.map((sub) => sub[0]),
187760
187818
  variables
187761
187819
  );
187762
- this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
187820
+ this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
187763
187821
  for (const [spec] of subscribers) {
187764
187822
  spec.set(
187765
187823
  this.cache._internal_unstable.getSelection({
@@ -187772,12 +187830,12 @@ var List3 = class {
187772
187830
  }
187773
187831
  return true;
187774
187832
  }
187775
- remove(data2, variables = {}) {
187833
+ remove(data2, variables = {}, layer) {
187776
187834
  const targetID = this.cache._internal_unstable.id(this.listType(data2), data2);
187777
187835
  if (!targetID) {
187778
187836
  return;
187779
187837
  }
187780
- return this.removeID(targetID, variables);
187838
+ return this.removeID(targetID, variables, layer);
187781
187839
  }
187782
187840
  listType(data2) {
187783
187841
  return data2.__typename || this.type;
@@ -187809,7 +187867,7 @@ var List3 = class {
187809
187867
  layer,
187810
187868
  where
187811
187869
  }) {
187812
- if (!this.remove(data2, variables)) {
187870
+ if (!this.remove(data2, variables, layer)) {
187813
187871
  this.addToList(selection, data2, variables, where, layer);
187814
187872
  }
187815
187873
  }
@@ -187942,7 +188000,7 @@ var StaleManager2 = class {
187942
188000
  };
187943
188001
  var InMemoryStorage2 = class {
187944
188002
  data;
187945
- idCount = 0;
188003
+ idCount = 1;
187946
188004
  rank = 0;
187947
188005
  constructor() {
187948
188006
  this.data = [];
@@ -187962,11 +188020,11 @@ var InMemoryStorage2 = class {
187962
188020
  insert(id2, field, location, target) {
187963
188021
  return this.topLayer.insert(id2, field, location, target);
187964
188022
  }
187965
- remove(id2, field, target) {
187966
- return this.topLayer.remove(id2, field, target);
188023
+ remove(id2, field, target, layerToUser = this.topLayer) {
188024
+ return layerToUser.remove(id2, field, target);
187967
188025
  }
187968
- delete(id2) {
187969
- return this.topLayer.delete(id2);
188026
+ delete(id2, layerToUser = this.topLayer) {
188027
+ return layerToUser.delete(id2);
187970
188028
  }
187971
188029
  deleteField(id2, field) {
187972
188030
  return this.topLayer.deleteField(id2, field);
@@ -188334,6 +188392,9 @@ var InMemorySubscriptions2 = class {
188334
188392
  subscribers = {};
188335
188393
  referenceCounts = {};
188336
188394
  keyVersions = {};
188395
+ activeFields(parent2) {
188396
+ return Object.keys(this.subscribers[parent2] || {});
188397
+ }
188337
188398
  add({
188338
188399
  parent: parent2,
188339
188400
  spec,
@@ -188600,20 +188661,7 @@ var Cache2 = class {
188600
188661
  }) {
188601
188662
  const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
188602
188663
  const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
188603
- const notified = [];
188604
- for (const spec of subscribers.concat(notifySubscribers)) {
188605
- if (!notified.includes(spec.set)) {
188606
- notified.push(spec.set);
188607
- spec.set(
188608
- this._internal_unstable.getSelection({
188609
- parent: spec.parentID || rootID2,
188610
- selection: spec.selection,
188611
- variables: spec.variables?.() || {},
188612
- ignoreMasking: false
188613
- }).data
188614
- );
188615
- }
188616
- }
188664
+ this.#notifySubscribers(subscribers.concat(notifySubscribers));
188617
188665
  return subscribers;
188618
188666
  }
188619
188667
  read(...args) {
@@ -188652,10 +188700,10 @@ var Cache2 = class {
188652
188700
  }
188653
188701
  return handler;
188654
188702
  }
188655
- delete(id2) {
188703
+ delete(id2, layer) {
188656
188704
  this._internal_unstable.subscriptions.removeAllSubscribers(id2);
188657
- this._internal_unstable.lists.removeIDFromAllLists(id2);
188658
- this._internal_unstable.storage.delete(id2);
188705
+ this._internal_unstable.lists.removeIDFromAllLists(id2, layer);
188706
+ this._internal_unstable.storage.delete(id2, layer);
188659
188707
  }
188660
188708
  setConfig(config4) {
188661
188709
  this._internal_unstable.setConfig(config4);
@@ -188687,6 +188735,70 @@ var Cache2 = class {
188687
188735
  config() {
188688
188736
  return this._internal_unstable.config;
188689
188737
  }
188738
+ clearLayer(layerID) {
188739
+ const layer = this._internal_unstable.storage.getLayer(layerID);
188740
+ if (!layer) {
188741
+ throw new Error("Cannot find layer with id: " + layerID);
188742
+ }
188743
+ const toNotify = [];
188744
+ const allFields = [];
188745
+ for (const target of [layer.fields, layer.links]) {
188746
+ for (const [id2, fields] of Object.entries(target)) {
188747
+ allFields.push(
188748
+ ...Object.entries(fields).map(([field, value2]) => ({ id: id2, field, value: value2 }))
188749
+ );
188750
+ }
188751
+ }
188752
+ const displayFields = [];
188753
+ for (const pair of allFields) {
188754
+ const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
188755
+ if (!displayLayers.includes(layerID)) {
188756
+ continue;
188757
+ }
188758
+ displayFields.push(pair);
188759
+ }
188760
+ for (const [id2, operation] of Object.entries(layer.operations)) {
188761
+ if (operation.deleted) {
188762
+ displayFields.push(
188763
+ ...this._internal_unstable.subscriptions.activeFields(id2).map((field) => ({ id: id2, field }))
188764
+ );
188765
+ }
188766
+ const fields = Object.keys(operation.fields ?? {});
188767
+ if (fields.length > 0) {
188768
+ displayFields.push(...fields.map((field) => ({ id: id2, field })));
188769
+ }
188770
+ }
188771
+ layer.clear();
188772
+ for (const display of displayFields) {
188773
+ const { field, id: id2 } = display;
188774
+ const notify = !("value" in display) || this._internal_unstable.storage.get(id2, field).value !== display.value;
188775
+ if (notify) {
188776
+ toNotify.push(
188777
+ ...this._internal_unstable.subscriptions.get(id2, field).map((sub) => sub[0])
188778
+ );
188779
+ }
188780
+ }
188781
+ this.#notifySubscribers(toNotify);
188782
+ }
188783
+ #notifySubscribers(subs) {
188784
+ if (subs.length === 0) {
188785
+ return;
188786
+ }
188787
+ const notified = [];
188788
+ for (const spec of subs) {
188789
+ if (!notified.includes(spec.set)) {
188790
+ notified.push(spec.set);
188791
+ spec.set(
188792
+ this._internal_unstable.getSelection({
188793
+ parent: spec.parentID || rootID2,
188794
+ selection: spec.selection,
188795
+ variables: spec.variables?.() || {},
188796
+ ignoreMasking: false
188797
+ }).data
188798
+ );
188799
+ }
188800
+ }
188801
+ }
188690
188802
  };
188691
188803
  var CacheInternal2 = class {
188692
188804
  _disabled = false;
@@ -188974,8 +189086,16 @@ var CacheInternal2 = class {
188974
189086
  operation.position || "last",
188975
189087
  layer
188976
189088
  );
189089
+ } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
189090
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
189091
+ selection: fieldSelection,
189092
+ data: target,
189093
+ variables,
189094
+ where: operation.position || "last",
189095
+ layer
189096
+ });
188977
189097
  } else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
188978
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
189098
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
188979
189099
  } else if (operation.action === "delete" && operation.type) {
188980
189100
  if (typeof target !== "string") {
188981
189101
  throw new Error("Cannot delete a record with a non-string ID");
@@ -188984,15 +189104,7 @@ var CacheInternal2 = class {
188984
189104
  if (!targetID) {
188985
189105
  continue;
188986
189106
  }
188987
- this.cache.delete(targetID);
188988
- } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
188989
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
188990
- selection: fieldSelection,
188991
- data: target,
188992
- variables,
188993
- where: operation.position || "last",
188994
- layer
188995
- });
189107
+ this.cache.delete(targetID, layer);
188996
189108
  }
188997
189109
  }
188998
189110
  }
@@ -189515,7 +189627,7 @@ var fragment3 = documentPlugin2(ArtifactKind2.Fragment, function() {
189515
189627
  var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
189516
189628
  return {
189517
189629
  async start(ctx, { next, marshalVariables }) {
189518
- const layer = cache_default2._internal_unstable.storage.createLayer(true);
189630
+ const layerOptimistic = cache_default2._internal_unstable.storage.createLayer(true);
189519
189631
  const optimisticResponse = ctx.stuff.optimisticResponse;
189520
189632
  let toNotify = [];
189521
189633
  if (optimisticResponse) {
@@ -189526,25 +189638,29 @@ var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
189526
189638
  data: optimisticResponse
189527
189639
  }),
189528
189640
  variables: marshalVariables(ctx),
189529
- layer: layer.id
189641
+ layer: layerOptimistic.id
189530
189642
  });
189531
189643
  }
189532
189644
  ctx.cacheParams = {
189533
189645
  ...ctx.cacheParams,
189534
- layer,
189646
+ layer: layerOptimistic,
189535
189647
  notifySubscribers: toNotify,
189536
189648
  forceNotify: true
189537
189649
  };
189538
189650
  next(ctx);
189539
189651
  },
189540
189652
  afterNetwork(ctx, { resolve: resolve22 }) {
189541
- ctx.cacheParams?.layer?.clear();
189653
+ if (ctx.cacheParams?.layer) {
189654
+ cache_default2.clearLayer(ctx.cacheParams.layer.id);
189655
+ }
189542
189656
  resolve22(ctx);
189543
189657
  },
189544
189658
  end(ctx, { resolve: resolve22, value: value2 }) {
189545
189659
  const hasErrors = value2.errors && value2.errors.length > 0;
189546
189660
  if (hasErrors) {
189547
- ctx.cacheParams?.layer?.clear();
189661
+ if (ctx.cacheParams?.layer) {
189662
+ cache_default2.clearLayer(ctx.cacheParams.layer.id);
189663
+ }
189548
189664
  }
189549
189665
  if (ctx.cacheParams?.layer) {
189550
189666
  cache_default2._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
@@ -189554,7 +189670,7 @@ var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
189554
189670
  catch(ctx, { error: error2 }) {
189555
189671
  if (ctx.cacheParams?.layer) {
189556
189672
  const { layer } = ctx.cacheParams;
189557
- layer.clear();
189673
+ cache_default2.clearLayer(layer.id);
189558
189674
  cache_default2._internal_unstable.storage.resolveLayer(layer.id);
189559
189675
  }
189560
189676
  throw error2;