@classytic/arc-next 0.14.0 → 0.15.0

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/hooks.d.ts CHANGED
@@ -90,6 +90,30 @@ interface CrudHooksConfig<T, TCreate = Partial<T>, TUpdate = Partial<T>> {
90
90
  gcTime?: number;
91
91
  refetchOnWindowFocus?: boolean;
92
92
  structuralSharing?: boolean;
93
+ /**
94
+ * Poll this resource's list/detail while mounted, in ms.
95
+ *
96
+ * Already supported PER CALL (`useList(params, { refetchInterval })`); this
97
+ * is the resource-level default, so a resource whose freshness matters
98
+ * declares it once instead of at every call site — and cannot be forgotten
99
+ * at one of them.
100
+ *
101
+ * The case that motivated it: an orders dashboard left open on a shop
102
+ * counter. Push notifications are best-effort, so the list is the
103
+ * AUTHORITATIVE path to a new order — but with no interval it relied on
104
+ * `refetchOnMount` / `refetchOnWindowFocus`, and a window that never blurs
105
+ * never refocuses, so it may never refetch. A missed push then reads as a
106
+ * missing record.
107
+ */
108
+ refetchInterval?: number | false;
109
+ /**
110
+ * Keep polling while the tab is hidden. Defaults to TanStack's `false`.
111
+ *
112
+ * Leave it off unless the data must be current the instant the operator
113
+ * returns — a background tab polling forever is load nobody is reading, and
114
+ * `refetchOnWindowFocus` already catches up on return.
115
+ */
116
+ refetchIntervalInBackground?: boolean;
93
117
  /**
94
118
  * Declare this resource's read endpoints PUBLIC (`allowPublic` on the
95
119
  * server — e.g. a storefront catalog). Read hooks then enable token-less
package/dist/hooks.js CHANGED
@@ -146,8 +146,8 @@ function createCrudHooks({ api, entityKey, singular, plural, idField, defaults =
146
146
  gcTime: queryOpts.gcTime ?? config.gcTime,
147
147
  refetchOnWindowFocus: queryOpts.refetchOnWindowFocus ?? config.refetchOnWindowFocus,
148
148
  structuralSharing: queryOpts.structuralSharing ?? config.structuralSharing,
149
- refetchInterval: queryOpts.refetchInterval,
150
- refetchIntervalInBackground: queryOpts.refetchIntervalInBackground
149
+ refetchInterval: queryOpts.refetchInterval ?? config.refetchInterval,
150
+ refetchIntervalInBackground: queryOpts.refetchIntervalInBackground ?? config.refetchIntervalInBackground
151
151
  },
152
152
  select: queryOpts.select
153
153
  });
@@ -236,8 +236,8 @@ function createCrudHooks({ api, entityKey, singular, plural, idField, defaults =
236
236
  gcTime: queryOpts.gcTime ?? config.gcTime,
237
237
  refetchOnWindowFocus: queryOpts.refetchOnWindowFocus ?? config.refetchOnWindowFocus,
238
238
  structuralSharing: queryOpts.structuralSharing ?? config.structuralSharing,
239
- refetchInterval: queryOpts.refetchInterval,
240
- refetchIntervalInBackground: queryOpts.refetchIntervalInBackground
239
+ refetchInterval: queryOpts.refetchInterval ?? config.refetchInterval,
240
+ refetchIntervalInBackground: queryOpts.refetchIntervalInBackground ?? config.refetchIntervalInBackground
241
241
  },
242
242
  select: queryOpts.select
243
243
  });
@@ -589,8 +589,8 @@ function createCrudHooks({ api, entityKey, singular, plural, idField, defaults =
589
589
  gcTime: queryOpts.gcTime ?? config.gcTime,
590
590
  refetchOnWindowFocus: queryOpts.refetchOnWindowFocus ?? config.refetchOnWindowFocus,
591
591
  structuralSharing: queryOpts.structuralSharing ?? config.structuralSharing,
592
- refetchInterval: queryOpts.refetchInterval,
593
- refetchIntervalInBackground: queryOpts.refetchIntervalInBackground
592
+ refetchInterval: queryOpts.refetchInterval ?? config.refetchInterval,
593
+ refetchIntervalInBackground: queryOpts.refetchIntervalInBackground ?? config.refetchIntervalInBackground
594
594
  }
595
595
  });
596
596
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classytic/arc-next",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "React + TanStack Query SDK for Arc resources",
5
5
  "type": "module",
6
6
  "sideEffects": false,