tsdf 17.0.0-beta.5 → 17.0.0-beta.6

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 (2) hide show
  1. package/dist/main.js +36 -1
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -8692,8 +8692,8 @@ function useMultipleItems$1(items, { selector, returnIdleStatus: allItemsReturnI
8692
8692
  if (isOffScreen) continue;
8693
8693
  if (itemId) {
8694
8694
  const itemState = getItemState(payload);
8695
- const fetchType = itemState?.refetchOnMount || "lowPriority";
8696
8695
  const requiredFetch = !itemState?.wasLoaded;
8696
+ const fetchType = itemState?.refetchOnMount && requiredFetch ? "highPriority" : itemState?.refetchOnMount || "lowPriority";
8697
8697
  if (itemState === null) continue;
8698
8698
  const shouldFetch = requiredFetch || !!itemState.refetchOnMount;
8699
8699
  if (!shouldFetch && ignoreItemsInRefetchOnMount.has(itemId)) continue;
@@ -14517,6 +14517,19 @@ function useMultipleItems(items, { selector, loadFromStateOnly, returnIdleStatus
14517
14517
  }
14518
14518
  }
14519
14519
  }
14520
+ if (itemState?.refetchOnMount && fetchType !== "highPriority") {
14521
+ let hasMissingRequestedData = requiredFetch;
14522
+ if (!hasMissingRequestedData && partialResources) {
14523
+ const loadedFields = store.state.itemLoadedFields[itemKey];
14524
+ const item = store.state.items[itemKey];
14525
+ if (Array.isArray(fields) && fields.length > 0) hasMissingRequestedData = getGenuinelyMissingRequestedFields(itemKey, {
14526
+ item,
14527
+ loadedFields
14528
+ }, fields, partialResources.inferFields, itemsPendingFullInvalidation, getUnresolvedPendingInvalidationFields(itemKey)).length > 0;
14529
+ else if (fields === "*") hasMissingRequestedData = !(itemsPendingFullInvalidation.has(itemKey) && !hasFullyLoadedFields(loadedFields) && !!item) && !snapshotIsFullyLoaded(loadedFields, item, partialResources.inferFields);
14530
+ }
14531
+ if (hasMissingRequestedData) fetchType = "highPriority";
14532
+ }
14520
14533
  if (!shouldFetch && ignoreItemsInRefetchOnMount.has(itemKey)) continue;
14521
14534
  ignoreItemsInRefetchOnMount.add(itemKey);
14522
14535
  if (shouldScheduleAutomaticFetch(itemState?.wasLoaded, shouldFetch, disableRefetches, disableRefetchOnMount, !!partialResources) && tryClaimAutomaticFetchSlot(automaticRetryState, retrySignature, itemState?.status)) scheduleAutomaticItemFetch(fetchType, payload, { fields: fieldsToFetch });
@@ -15119,6 +15132,28 @@ function useMultipleListQueries(queries, { itemSelector, returnIdleStatus: allIt
15119
15132
  }
15120
15133
  }
15121
15134
  }
15135
+ if (queryState?.refetchOnMount && fetchType !== "highPriority") {
15136
+ let hasMissingRequestedData = requiredFetch;
15137
+ if (!hasMissingRequestedData && partialResources && effectiveQueryState) {
15138
+ if (Array.isArray(fields) && fields.length > 0) {
15139
+ for (const itemKey of effectiveQueryState.items) if (getGenuinelyMissingRequestedFields(itemKey, {
15140
+ item: store.state.items[itemKey],
15141
+ loadedFields: store.state.itemLoadedFields[itemKey]
15142
+ }, fields, partialResources.inferFields, itemsPendingFullInvalidation, getUnresolvedPendingInvalidationFields(itemKey)).length > 0) {
15143
+ hasMissingRequestedData = true;
15144
+ break;
15145
+ }
15146
+ } else if (fields === "*") for (const itemKey of effectiveQueryState.items) {
15147
+ const item = store.state.items[itemKey];
15148
+ const loadedFields = store.state.itemLoadedFields[itemKey];
15149
+ if (!(itemsPendingFullInvalidation.has(itemKey) && !hasFullyLoadedFields(loadedFields) && !!item) && !snapshotIsFullyLoaded(loadedFields, item, partialResources.inferFields)) {
15150
+ hasMissingRequestedData = true;
15151
+ break;
15152
+ }
15153
+ }
15154
+ }
15155
+ if (hasMissingRequestedData) fetchType = "highPriority";
15156
+ }
15122
15157
  const offScreenInvalidationPriority = pendingOffScreenQueryInvalidations.get(queryId);
15123
15158
  if (offScreenInvalidationPriority !== void 0) {
15124
15159
  pendingOffScreenQueryInvalidations.delete(queryId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdf",
3
- "version": "17.0.0-beta.5",
3
+ "version": "17.0.0-beta.6",
4
4
  "description": "A data fetching solution based on t-state",
5
5
  "license": "PolyForm-Noncommercial-1.0.0",
6
6
  "author": "Lucas Santos",