tsdf 18.0.0 → 18.0.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.js +6 -6
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -12,7 +12,7 @@ import { Result, isResult, resultify, unknownToError } from "t-result";
|
|
|
12
12
|
import { Store, useSubscribeToStore } from "t-state";
|
|
13
13
|
import { useOnChange } from "@ls-stack/react-utils/useOnChange";
|
|
14
14
|
import { useConst } from "@ls-stack/react-utils/useConst";
|
|
15
|
-
import {
|
|
15
|
+
import { useLatestCb } from "@ls-stack/react-utils/useLatestValue";
|
|
16
16
|
import { useTimeout } from "@ls-stack/react-utils/useTimeout";
|
|
17
17
|
import { isObject, isPromise } from "@ls-stack/utils/typeGuards";
|
|
18
18
|
import { rc_array, rc_boolean, rc_literals, rc_number, rc_object, rc_parse, rc_parse_json, rc_record, rc_string, rc_union, rc_unknown } from "runcheck";
|
|
@@ -146,8 +146,8 @@ function useListItemIsLoading({ listIsLoading, isRefetching, itemExists, loadIte
|
|
|
146
146
|
const ignoreSetWillBeRefetched = useRef(false);
|
|
147
147
|
const itemWasRefetched = useConst(() => /* @__PURE__ */ new Set());
|
|
148
148
|
if (isNotFound && !isRefetching && !willBeRefetched && !ignoreSetWillBeRefetched.current && itemId && !itemWasRefetched.has(itemId)) setWillBeRefetched(true);
|
|
149
|
-
const
|
|
150
|
-
const latestLoadItemFallback =
|
|
149
|
+
const getIsLoadingOrRefetching = useLatestCb(() => listIsLoading || isRefetching);
|
|
150
|
+
const latestLoadItemFallback = useLatestCb(loadItemFallback);
|
|
151
151
|
useEffect(() => {
|
|
152
152
|
if (isRefetching) {
|
|
153
153
|
if (itemId) itemWasRefetched.add(itemId);
|
|
@@ -165,8 +165,8 @@ function useListItemIsLoading({ listIsLoading, isRefetching, itemExists, loadIte
|
|
|
165
165
|
useEffect(() => {
|
|
166
166
|
if (willBeRefetched) {
|
|
167
167
|
callFallbackLoadItemTimeout.call(() => {
|
|
168
|
-
if (!
|
|
169
|
-
latestLoadItemFallback
|
|
168
|
+
if (!getIsLoadingOrRefetching()) {
|
|
169
|
+
latestLoadItemFallback();
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
172
|
});
|
|
@@ -185,7 +185,7 @@ function useListItemIsLoading({ listIsLoading, isRefetching, itemExists, loadIte
|
|
|
185
185
|
}, [
|
|
186
186
|
resetWillBeRefetchedTimeout,
|
|
187
187
|
willBeRefetched,
|
|
188
|
-
|
|
188
|
+
getIsLoadingOrRefetching,
|
|
189
189
|
latestLoadItemFallback,
|
|
190
190
|
callFallbackLoadItemTimeout
|
|
191
191
|
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdf",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.1",
|
|
4
4
|
"description": "A data fetching solution based on t-state",
|
|
5
5
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"author": "Lucas Santos",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@evtmitter/react": "^0.1.0",
|
|
72
72
|
"@ls-stack/browser-utils": "^0.3.5",
|
|
73
|
-
"@ls-stack/react-utils": "^0.13.
|
|
73
|
+
"@ls-stack/react-utils": "^0.13.3",
|
|
74
74
|
"@ls-stack/utils": "^4.0.0",
|
|
75
75
|
"@standard-schema/spec": "^1.1.0",
|
|
76
76
|
"evtmitter": "^1.0.2",
|