@verii/components-organizations-registrar 1.0.0-pre.1754432266 → 1.0.0-pre.1754473009

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/dist/index.cjs CHANGED
@@ -151,10 +151,11 @@ function replaceEqualDeep(a, b) {
151
151
  const bItems = array ? b : Object.keys(b);
152
152
  const bSize = bItems.length;
153
153
  const copy = array ? [] : {};
154
+ const aItemsSet = new Set(aItems);
154
155
  let equalItems = 0;
155
156
  for (let i = 0; i < bSize; i++) {
156
157
  const key = array ? i : bItems[i];
157
- if ((!array && aItems.includes(key) || array) && a[key] === void 0 && b[key] === void 0) {
158
+ if ((!array && aItemsSet.has(key) || array) && a[key] === void 0 && b[key] === void 0) {
158
159
  copy[key] = void 0;
159
160
  equalItems++;
160
161
  } else {
@@ -684,19 +685,33 @@ var Query = class extends Removable {
684
685
  }
685
686
  return this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
686
687
  }
687
- isStale() {
688
- if (this.state.isInvalidated) {
689
- return true;
688
+ isStatic() {
689
+ if (this.getObserversCount() > 0) {
690
+ return this.observers.some(
691
+ (observer) => resolveStaleTime(observer.options.staleTime, this) === "static"
692
+ );
690
693
  }
694
+ return false;
695
+ }
696
+ isStale() {
691
697
  if (this.getObserversCount() > 0) {
692
698
  return this.observers.some(
693
699
  (observer) => observer.getCurrentResult().isStale
694
700
  );
695
701
  }
696
- return this.state.data === void 0;
702
+ return this.state.data === void 0 || this.state.isInvalidated;
697
703
  }
698
704
  isStaleByTime(staleTime = 0) {
699
- return this.state.isInvalidated || this.state.data === void 0 || !timeUntilStale(this.state.dataUpdatedAt, staleTime);
705
+ if (this.state.data === void 0) {
706
+ return true;
707
+ }
708
+ if (staleTime === "static") {
709
+ return false;
710
+ }
711
+ if (this.state.isInvalidated) {
712
+ return true;
713
+ }
714
+ return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
700
715
  }
701
716
  onFocus() {
702
717
  const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());
@@ -776,12 +791,16 @@ var Query = class extends Removable {
776
791
  };
777
792
  const fetchFn = () => {
778
793
  const queryFn = ensureQueryFn(this.options, fetchOptions);
779
- const queryFnContext = {
780
- client: this.#client,
781
- queryKey: this.queryKey,
782
- meta: this.meta
794
+ const createQueryFnContext = () => {
795
+ const queryFnContext2 = {
796
+ client: this.#client,
797
+ queryKey: this.queryKey,
798
+ meta: this.meta
799
+ };
800
+ addSignalProperty(queryFnContext2);
801
+ return queryFnContext2;
783
802
  };
784
- addSignalProperty(queryFnContext);
803
+ const queryFnContext = createQueryFnContext();
785
804
  this.#abortSignalConsumed = false;
786
805
  if (this.options.persister) {
787
806
  return this.options.persister(
@@ -792,19 +811,20 @@ var Query = class extends Removable {
792
811
  }
793
812
  return queryFn(queryFnContext);
794
813
  };
795
- const context = {
796
- fetchOptions,
797
- options: this.options,
798
- queryKey: this.queryKey,
799
- client: this.#client,
800
- state: this.state,
801
- fetchFn
814
+ const createFetchContext = () => {
815
+ const context2 = {
816
+ fetchOptions,
817
+ options: this.options,
818
+ queryKey: this.queryKey,
819
+ client: this.#client,
820
+ state: this.state,
821
+ fetchFn
822
+ };
823
+ addSignalProperty(context2);
824
+ return context2;
802
825
  };
803
- addSignalProperty(context);
804
- this.options.behavior?.onFetch(
805
- context,
806
- this
807
- );
826
+ const context = createFetchContext();
827
+ this.options.behavior?.onFetch(context, this);
808
828
  this.#revertState = this.state;
809
829
  if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) {
810
830
  this.#dispatch({ type: "fetch", meta: context.fetchOptions?.meta });
@@ -900,6 +920,7 @@ var Query = class extends Removable {
900
920
  fetchMeta: action.meta ?? null
901
921
  };
902
922
  case "success":
923
+ this.#revertState = void 0;
903
924
  return {
904
925
  ...state,
905
926
  data: action.data,
@@ -1122,6 +1143,9 @@ var Mutation = class extends Removable {
1122
1143
  this.execute(this.state.variables);
1123
1144
  }
1124
1145
  async execute(variables) {
1146
+ const onContinue = () => {
1147
+ this.#dispatch({ type: "continue" });
1148
+ };
1125
1149
  this.#retryer = createRetryer({
1126
1150
  fn: () => {
1127
1151
  if (!this.options.mutationFn) {
@@ -1135,9 +1159,7 @@ var Mutation = class extends Removable {
1135
1159
  onPause: () => {
1136
1160
  this.#dispatch({ type: "pause" });
1137
1161
  },
1138
- onContinue: () => {
1139
- this.#dispatch({ type: "continue" });
1140
- },
1162
+ onContinue,
1141
1163
  retry: this.options.retry ?? 0,
1142
1164
  retryDelay: this.options.retryDelay,
1143
1165
  networkMode: this.options.networkMode,
@@ -1146,7 +1168,9 @@ var Mutation = class extends Removable {
1146
1168
  const restored = this.state.status === "pending";
1147
1169
  const isPaused = !this.#retryer.canStart();
1148
1170
  try {
1149
- if (!restored) {
1171
+ if (restored) {
1172
+ onContinue();
1173
+ } else {
1150
1174
  this.#dispatch({ type: "pending", variables, isPaused });
1151
1175
  await this.#mutationCache.config.onMutate?.(
1152
1176
  variables,
@@ -1442,17 +1466,19 @@ function infiniteQueryBehavior(pages) {
1442
1466
  if (param == null && data.pages.length) {
1443
1467
  return Promise.resolve(data);
1444
1468
  }
1445
- const queryFnContext = {
1446
- client: context.client,
1447
- queryKey: context.queryKey,
1448
- pageParam: param,
1449
- direction: previous ? "backward" : "forward",
1450
- meta: context.options.meta
1469
+ const createQueryFnContext = () => {
1470
+ const queryFnContext2 = {
1471
+ client: context.client,
1472
+ queryKey: context.queryKey,
1473
+ pageParam: param,
1474
+ direction: previous ? "backward" : "forward",
1475
+ meta: context.options.meta
1476
+ };
1477
+ addSignalProperty(queryFnContext2);
1478
+ return queryFnContext2;
1451
1479
  };
1452
- addSignalProperty(queryFnContext);
1453
- const page = await queryFn(
1454
- queryFnContext
1455
- );
1480
+ const queryFnContext = createQueryFnContext();
1481
+ const page = await queryFn(queryFnContext);
1456
1482
  const { maxPages } = context.options;
1457
1483
  const addTo = previous ? addToStart : addToEnd;
1458
1484
  return {
@@ -1668,7 +1694,7 @@ var QueryClient = class {
1668
1694
  cancelRefetch: options.cancelRefetch ?? true
1669
1695
  };
1670
1696
  const promises = notifyManager.batch(
1671
- () => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled()).map((query) => {
1697
+ () => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
1672
1698
  let promise = query.fetch(void 0, fetchOptions);
1673
1699
  if (!fetchOptions.throwOnError) {
1674
1700
  promise = promise.catch(noop);