tsdf 12.6.0 → 12.6.2
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 +9 -8
- package/dist/main.d.cts +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +9 -8
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -50,7 +50,7 @@ function createFetchOrquestrator({
|
|
|
50
50
|
let mutationIsInProgress = false;
|
|
51
51
|
let lastFetchStartTime = 0;
|
|
52
52
|
let lastFetchDuration = 0;
|
|
53
|
-
let onMutationEnd =
|
|
53
|
+
let onMutationEnd = null;
|
|
54
54
|
let lastFetchWasAborted = false;
|
|
55
55
|
let abortFetchsBeforeOrEqual = 0;
|
|
56
56
|
function setLastFetchDurantion(duration) {
|
|
@@ -78,9 +78,9 @@ function createFetchOrquestrator({
|
|
|
78
78
|
function endMutation(id) {
|
|
79
79
|
if (id === lastMutationIdStarted) {
|
|
80
80
|
mutationIsInProgress = false;
|
|
81
|
-
if (onMutationEnd
|
|
82
|
-
onMutationEnd
|
|
83
|
-
onMutationEnd =
|
|
81
|
+
if (onMutationEnd) {
|
|
82
|
+
onMutationEnd();
|
|
83
|
+
onMutationEnd = null;
|
|
84
84
|
}
|
|
85
85
|
flushScheduledFetch();
|
|
86
86
|
return true;
|
|
@@ -222,13 +222,13 @@ function createFetchOrquestrator({
|
|
|
222
222
|
};
|
|
223
223
|
return true;
|
|
224
224
|
} else if (mutationIsInProgress) {
|
|
225
|
-
onMutationEnd
|
|
225
|
+
onMutationEnd = () => {
|
|
226
226
|
const added = addDelayedRTU(Date.now(), params);
|
|
227
227
|
if (!added) {
|
|
228
228
|
on?.("scheduled-rt-fetch-started");
|
|
229
229
|
scheduleFetch("highPriority", params);
|
|
230
230
|
}
|
|
231
|
-
}
|
|
231
|
+
};
|
|
232
232
|
return true;
|
|
233
233
|
} else {
|
|
234
234
|
if (!addDelayedRTU(startTime, params)) {
|
|
@@ -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
|
-
|
|
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
|
@@ -21,7 +21,7 @@ function createFetchOrquestrator({
|
|
|
21
21
|
let mutationIsInProgress = false;
|
|
22
22
|
let lastFetchStartTime = 0;
|
|
23
23
|
let lastFetchDuration = 0;
|
|
24
|
-
let onMutationEnd =
|
|
24
|
+
let onMutationEnd = null;
|
|
25
25
|
let lastFetchWasAborted = false;
|
|
26
26
|
let abortFetchsBeforeOrEqual = 0;
|
|
27
27
|
function setLastFetchDurantion(duration) {
|
|
@@ -49,9 +49,9 @@ function createFetchOrquestrator({
|
|
|
49
49
|
function endMutation(id) {
|
|
50
50
|
if (id === lastMutationIdStarted) {
|
|
51
51
|
mutationIsInProgress = false;
|
|
52
|
-
if (onMutationEnd
|
|
53
|
-
onMutationEnd
|
|
54
|
-
onMutationEnd =
|
|
52
|
+
if (onMutationEnd) {
|
|
53
|
+
onMutationEnd();
|
|
54
|
+
onMutationEnd = null;
|
|
55
55
|
}
|
|
56
56
|
flushScheduledFetch();
|
|
57
57
|
return true;
|
|
@@ -193,13 +193,13 @@ function createFetchOrquestrator({
|
|
|
193
193
|
};
|
|
194
194
|
return true;
|
|
195
195
|
} else if (mutationIsInProgress) {
|
|
196
|
-
onMutationEnd
|
|
196
|
+
onMutationEnd = () => {
|
|
197
197
|
const added = addDelayedRTU(Date.now(), params);
|
|
198
198
|
if (!added) {
|
|
199
199
|
on?.("scheduled-rt-fetch-started");
|
|
200
200
|
scheduleFetch("highPriority", params);
|
|
201
201
|
}
|
|
202
|
-
}
|
|
202
|
+
};
|
|
203
203
|
return true;
|
|
204
204
|
} else {
|
|
205
205
|
if (!addDelayedRTU(startTime, params)) {
|
|
@@ -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
|
-
|
|
2195
|
+
if (itemId)
|
|
2196
|
+
itemWasRefetched.add(itemId);
|
|
2196
2197
|
resetWillBeRefechedTimeout.clear();
|
|
2197
2198
|
callFallbackLoadItemTimeout.clear();
|
|
2198
2199
|
setWillBeRefetched(false);
|