tsdf 12.6.0 → 12.6.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.
package/dist/main.cjs CHANGED
@@ -2214,14 +2214,15 @@ function useListItemIsLoading({
2214
2214
  const callFallbackLoadItemTimeout = useTimeout(100);
2215
2215
  const ignoreSetWillBeRefetched = (0, import_react11.useRef)(false);
2216
2216
  const itemWasRefetched = useConst(() => /* @__PURE__ */ new Set());
2217
- if (isNotFound && !isRefetching && !willBeRefetched && !ignoreSetWillBeRefetched.current && !itemWasRefetched.has(itemId)) {
2217
+ if (isNotFound && !isRefetching && !willBeRefetched && !ignoreSetWillBeRefetched.current && itemId && !itemWasRefetched.has(itemId)) {
2218
2218
  setWillBeRefetched(true);
2219
2219
  }
2220
2220
  const latestIsLoadingOrRefetching = useLatestValue(isLoading || isRefetching);
2221
2221
  const latestLoadItemFallback = useLatestValue(loadItemFallback);
2222
2222
  (0, import_react11.useEffect)(() => {
2223
2223
  if (isRefetching) {
2224
- itemWasRefetched.add(itemId);
2224
+ if (itemId)
2225
+ itemWasRefetched.add(itemId);
2225
2226
  resetWillBeRefechedTimeout.clear();
2226
2227
  callFallbackLoadItemTimeout.clear();
2227
2228
  setWillBeRefetched(false);
package/dist/main.d.cts CHANGED
@@ -336,7 +336,7 @@ type TSFDListQueryStore<ItemState extends ValidStoreState, NError, QueryPayload
336
336
  /** Use to detect if a item of a list may be loading in cases which there is no
337
337
  * clear indication of the status of individual items, ex: an item in a document collection that is loaded on demand */
338
338
  declare function useListItemIsLoading({ isLoading, isRefetching, isNotFound, loadItemFallback, itemId, }: {
339
- itemId: string;
339
+ itemId: string | null | false;
340
340
  isRefetching: boolean;
341
341
  isLoading: boolean;
342
342
  isNotFound: boolean;
package/dist/main.d.ts CHANGED
@@ -336,7 +336,7 @@ type TSFDListQueryStore<ItemState extends ValidStoreState, NError, QueryPayload
336
336
  /** Use to detect if a item of a list may be loading in cases which there is no
337
337
  * clear indication of the status of individual items, ex: an item in a document collection that is loaded on demand */
338
338
  declare function useListItemIsLoading({ isLoading, isRefetching, isNotFound, loadItemFallback, itemId, }: {
339
- itemId: string;
339
+ itemId: string | null | false;
340
340
  isRefetching: boolean;
341
341
  isLoading: boolean;
342
342
  isNotFound: boolean;
package/dist/main.js CHANGED
@@ -2185,14 +2185,15 @@ function useListItemIsLoading({
2185
2185
  const callFallbackLoadItemTimeout = useTimeout(100);
2186
2186
  const ignoreSetWillBeRefetched = useRef2(false);
2187
2187
  const itemWasRefetched = useConst(() => /* @__PURE__ */ new Set());
2188
- if (isNotFound && !isRefetching && !willBeRefetched && !ignoreSetWillBeRefetched.current && !itemWasRefetched.has(itemId)) {
2188
+ if (isNotFound && !isRefetching && !willBeRefetched && !ignoreSetWillBeRefetched.current && itemId && !itemWasRefetched.has(itemId)) {
2189
2189
  setWillBeRefetched(true);
2190
2190
  }
2191
2191
  const latestIsLoadingOrRefetching = useLatestValue(isLoading || isRefetching);
2192
2192
  const latestLoadItemFallback = useLatestValue(loadItemFallback);
2193
2193
  useEffect6(() => {
2194
2194
  if (isRefetching) {
2195
- itemWasRefetched.add(itemId);
2195
+ if (itemId)
2196
+ itemWasRefetched.add(itemId);
2196
2197
  resetWillBeRefechedTimeout.clear();
2197
2198
  callFallbackLoadItemTimeout.clear();
2198
2199
  setWillBeRefetched(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdf",
3
- "version": "12.6.0",
3
+ "version": "12.6.1",
4
4
  "description": "A data fetching solution based on t-state",
5
5
  "license": "MIT",
6
6
  "author": "Lucas Santos",