tsdf 11.1.2 → 11.1.3
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 +10 -2
- package/dist/main.d.ts +1 -1
- package/dist/main.js +10 -2
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -115,6 +115,10 @@ function createFetchOrquestrator({
|
|
|
115
115
|
lastFetchWasAborted = abort;
|
|
116
116
|
return abort;
|
|
117
117
|
}
|
|
118
|
+
if (fetchs.b) {
|
|
119
|
+
clearTimeout(fetchs.b.timeoutId);
|
|
120
|
+
fetchs.b = null;
|
|
121
|
+
}
|
|
118
122
|
const success = await fetchFn(
|
|
119
123
|
{
|
|
120
124
|
shouldAbort,
|
|
@@ -130,8 +134,9 @@ function createFetchOrquestrator({
|
|
|
130
134
|
if (success) {
|
|
131
135
|
lastFetchDuration = Date.now() - startTime;
|
|
132
136
|
}
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
const rtScheduled = fetchs.b;
|
|
138
|
+
if (rtScheduled) {
|
|
139
|
+
clearTimeout(rtScheduled.timeoutId);
|
|
135
140
|
fetchs.b = null;
|
|
136
141
|
}
|
|
137
142
|
const onEnd = currentFetchs.a.onEnd;
|
|
@@ -555,6 +560,8 @@ function newTSDFDocumentStore({
|
|
|
555
560
|
return useModifyResult(storeState);
|
|
556
561
|
}
|
|
557
562
|
function updateState(produceNewData) {
|
|
563
|
+
if (!store.state.data)
|
|
564
|
+
return false;
|
|
558
565
|
store.setKey(
|
|
559
566
|
"data",
|
|
560
567
|
(current) => {
|
|
@@ -564,6 +571,7 @@ function newTSDFDocumentStore({
|
|
|
564
571
|
},
|
|
565
572
|
{ action: "update-state" }
|
|
566
573
|
);
|
|
574
|
+
return true;
|
|
567
575
|
}
|
|
568
576
|
return {
|
|
569
577
|
store,
|
package/dist/main.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ declare function newTSDFDocumentStore<State extends ValidStoreState, NError>({ d
|
|
|
49
49
|
ensureIsLoaded?: boolean | undefined;
|
|
50
50
|
returnRefetchingStatus?: boolean | undefined;
|
|
51
51
|
}) => Readonly<TSDFUseDocumentReturn<Selected, NError>>;
|
|
52
|
-
updateState: (produceNewData: (draftData: State) => State | void | undefined) =>
|
|
52
|
+
updateState: (produceNewData: (draftData: State) => State | void | undefined) => boolean;
|
|
53
53
|
startMutation: () => () => boolean;
|
|
54
54
|
};
|
|
55
55
|
type TSDFDocumentStore<State extends ValidStoreState, NError> = ReturnType<typeof newTSDFDocumentStore<State, NError>>;
|
package/dist/main.js
CHANGED
|
@@ -77,6 +77,10 @@ function createFetchOrquestrator({
|
|
|
77
77
|
lastFetchWasAborted = abort;
|
|
78
78
|
return abort;
|
|
79
79
|
}
|
|
80
|
+
if (fetchs.b) {
|
|
81
|
+
clearTimeout(fetchs.b.timeoutId);
|
|
82
|
+
fetchs.b = null;
|
|
83
|
+
}
|
|
80
84
|
const success = await fetchFn(
|
|
81
85
|
{
|
|
82
86
|
shouldAbort,
|
|
@@ -92,8 +96,9 @@ function createFetchOrquestrator({
|
|
|
92
96
|
if (success) {
|
|
93
97
|
lastFetchDuration = Date.now() - startTime;
|
|
94
98
|
}
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
const rtScheduled = fetchs.b;
|
|
100
|
+
if (rtScheduled) {
|
|
101
|
+
clearTimeout(rtScheduled.timeoutId);
|
|
97
102
|
fetchs.b = null;
|
|
98
103
|
}
|
|
99
104
|
const onEnd = currentFetchs.a.onEnd;
|
|
@@ -517,6 +522,8 @@ function newTSDFDocumentStore({
|
|
|
517
522
|
return useModifyResult(storeState);
|
|
518
523
|
}
|
|
519
524
|
function updateState(produceNewData) {
|
|
525
|
+
if (!store.state.data)
|
|
526
|
+
return false;
|
|
520
527
|
store.setKey(
|
|
521
528
|
"data",
|
|
522
529
|
(current) => {
|
|
@@ -526,6 +533,7 @@ function newTSDFDocumentStore({
|
|
|
526
533
|
},
|
|
527
534
|
{ action: "update-state" }
|
|
528
535
|
);
|
|
536
|
+
return true;
|
|
529
537
|
}
|
|
530
538
|
return {
|
|
531
539
|
store,
|