tsdf 8.0.0-beta.12 → 8.0.0-beta.13

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.
Files changed (3) hide show
  1. package/dist/main.cjs +15 -21
  2. package/dist/main.js +15 -21
  3. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -520,13 +520,14 @@ function newTSDFDocumentStore({
520
520
  (0, import_react3.useEffect)(() => {
521
521
  if (disabled)
522
522
  return;
523
+ const fetchType = store.state.refetchOnMount || "lowPriority";
523
524
  if (disableRefetchOnMount) {
524
525
  const shouldFetch = store.state.refetchOnMount || store.state.status === "idle";
525
526
  if (shouldFetch) {
526
- scheduleFetch(store.state.refetchOnMount || "lowPriority");
527
+ scheduleFetch(fetchType);
527
528
  }
528
529
  } else {
529
- scheduleFetch("lowPriority");
530
+ scheduleFetch(fetchType);
530
531
  }
531
532
  }, [disableRefetchOnMount, disabled]);
532
533
  const [useModifyResult, emitIsLoadedEvt] = useEnsureIsLoaded(
@@ -890,18 +891,16 @@ function newTSDFCollectionStore({
890
891
  (0, import_react4.useEffect)(() => {
891
892
  for (const { itemKey: itemId, payload } of queriesWithId) {
892
893
  if (itemId) {
894
+ const itemState = getItemState(payload);
895
+ const fetchType = itemState?.refetchOnMount || "lowPriority";
893
896
  if (disableRefetchOnMount) {
894
- const itemState = getItemState(payload);
895
897
  const shouldFetch = !itemState?.wasLoaded || itemState.refetchOnMount;
896
898
  if (shouldFetch) {
897
- scheduleFetch(
898
- itemState?.refetchOnMount || "lowPriority",
899
- payload
900
- );
899
+ scheduleFetch(fetchType, payload);
901
900
  return;
902
901
  }
903
902
  } else {
904
- scheduleFetch("lowPriority", payload);
903
+ scheduleFetch(fetchType, payload);
905
904
  }
906
905
  }
907
906
  }
@@ -1423,19 +1422,16 @@ function newTSDFListQueryStore({
1423
1422
  (0, import_react5.useEffect)(() => {
1424
1423
  for (const { key: itemId, payload: fetchParams } of queriesWithId) {
1425
1424
  if (itemId) {
1425
+ const itemState = getQueryState(fetchParams);
1426
+ const fetchType = itemState?.refetchOnMount || "lowPriority";
1426
1427
  if (disableRefetchOnMount) {
1427
- const itemState = getQueryState(fetchParams);
1428
1428
  const shouldFetch = !itemState || !itemState.wasLoaded || itemState.refetchOnMount;
1429
1429
  if (shouldFetch) {
1430
- scheduleListQueryFetch(
1431
- itemState?.refetchOnMount || "lowPriority",
1432
- fetchParams,
1433
- loadSizeConst
1434
- );
1430
+ scheduleListQueryFetch(fetchType, fetchParams, loadSizeConst);
1435
1431
  return;
1436
1432
  }
1437
1433
  } else {
1438
- scheduleListQueryFetch("lowPriority", fetchParams, loadSizeConst);
1434
+ scheduleListQueryFetch(fetchType, fetchParams, loadSizeConst);
1439
1435
  }
1440
1436
  }
1441
1437
  }
@@ -1735,18 +1731,16 @@ function newTSDFListQueryStore({
1735
1731
  (0, import_react5.useEffect)(() => {
1736
1732
  for (const { payload, itemKey } of memoizedItemKeys) {
1737
1733
  if (itemKey) {
1734
+ const itemState = store.state.itemQueries[itemKey];
1735
+ const fetchType = itemState?.refetchOnMount || "lowPriority";
1738
1736
  if (disableRefetchOnMount) {
1739
- const itemState = store.state.itemQueries[itemKey];
1740
1737
  const shouldFetch = !itemState || !itemState.wasLoaded || itemState.refetchOnMount;
1741
1738
  if (shouldFetch) {
1742
- scheduleItemFetch(
1743
- itemState?.refetchOnMount || "lowPriority",
1744
- payload
1745
- );
1739
+ scheduleItemFetch(fetchType, payload);
1746
1740
  return;
1747
1741
  }
1748
1742
  } else {
1749
- scheduleItemFetch("lowPriority", payload);
1743
+ scheduleItemFetch(fetchType, payload);
1750
1744
  }
1751
1745
  }
1752
1746
  }
package/dist/main.js CHANGED
@@ -486,13 +486,14 @@ function newTSDFDocumentStore({
486
486
  useEffect2(() => {
487
487
  if (disabled)
488
488
  return;
489
+ const fetchType = store.state.refetchOnMount || "lowPriority";
489
490
  if (disableRefetchOnMount) {
490
491
  const shouldFetch = store.state.refetchOnMount || store.state.status === "idle";
491
492
  if (shouldFetch) {
492
- scheduleFetch(store.state.refetchOnMount || "lowPriority");
493
+ scheduleFetch(fetchType);
493
494
  }
494
495
  } else {
495
- scheduleFetch("lowPriority");
496
+ scheduleFetch(fetchType);
496
497
  }
497
498
  }, [disableRefetchOnMount, disabled]);
498
499
  const [useModifyResult, emitIsLoadedEvt] = useEnsureIsLoaded(
@@ -856,18 +857,16 @@ function newTSDFCollectionStore({
856
857
  useEffect3(() => {
857
858
  for (const { itemKey: itemId, payload } of queriesWithId) {
858
859
  if (itemId) {
860
+ const itemState = getItemState(payload);
861
+ const fetchType = itemState?.refetchOnMount || "lowPriority";
859
862
  if (disableRefetchOnMount) {
860
- const itemState = getItemState(payload);
861
863
  const shouldFetch = !itemState?.wasLoaded || itemState.refetchOnMount;
862
864
  if (shouldFetch) {
863
- scheduleFetch(
864
- itemState?.refetchOnMount || "lowPriority",
865
- payload
866
- );
865
+ scheduleFetch(fetchType, payload);
867
866
  return;
868
867
  }
869
868
  } else {
870
- scheduleFetch("lowPriority", payload);
869
+ scheduleFetch(fetchType, payload);
871
870
  }
872
871
  }
873
872
  }
@@ -1389,19 +1388,16 @@ function newTSDFListQueryStore({
1389
1388
  useEffect4(() => {
1390
1389
  for (const { key: itemId, payload: fetchParams } of queriesWithId) {
1391
1390
  if (itemId) {
1391
+ const itemState = getQueryState(fetchParams);
1392
+ const fetchType = itemState?.refetchOnMount || "lowPriority";
1392
1393
  if (disableRefetchOnMount) {
1393
- const itemState = getQueryState(fetchParams);
1394
1394
  const shouldFetch = !itemState || !itemState.wasLoaded || itemState.refetchOnMount;
1395
1395
  if (shouldFetch) {
1396
- scheduleListQueryFetch(
1397
- itemState?.refetchOnMount || "lowPriority",
1398
- fetchParams,
1399
- loadSizeConst
1400
- );
1396
+ scheduleListQueryFetch(fetchType, fetchParams, loadSizeConst);
1401
1397
  return;
1402
1398
  }
1403
1399
  } else {
1404
- scheduleListQueryFetch("lowPriority", fetchParams, loadSizeConst);
1400
+ scheduleListQueryFetch(fetchType, fetchParams, loadSizeConst);
1405
1401
  }
1406
1402
  }
1407
1403
  }
@@ -1701,18 +1697,16 @@ function newTSDFListQueryStore({
1701
1697
  useEffect4(() => {
1702
1698
  for (const { payload, itemKey } of memoizedItemKeys) {
1703
1699
  if (itemKey) {
1700
+ const itemState = store.state.itemQueries[itemKey];
1701
+ const fetchType = itemState?.refetchOnMount || "lowPriority";
1704
1702
  if (disableRefetchOnMount) {
1705
- const itemState = store.state.itemQueries[itemKey];
1706
1703
  const shouldFetch = !itemState || !itemState.wasLoaded || itemState.refetchOnMount;
1707
1704
  if (shouldFetch) {
1708
- scheduleItemFetch(
1709
- itemState?.refetchOnMount || "lowPriority",
1710
- payload
1711
- );
1705
+ scheduleItemFetch(fetchType, payload);
1712
1706
  return;
1713
1707
  }
1714
1708
  } else {
1715
- scheduleItemFetch("lowPriority", payload);
1709
+ scheduleItemFetch(fetchType, payload);
1716
1710
  }
1717
1711
  }
1718
1712
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdf",
3
- "version": "8.0.0-beta.12",
3
+ "version": "8.0.0-beta.13",
4
4
  "description": "A data fetching solution based on t-state",
5
5
  "license": "MIT",
6
6
  "author": "Lucas Santos",