tsdf 11.1.0 → 11.1.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 +15 -6
- package/dist/main.js +11 -6
- package/package.json +6 -6
package/dist/main.cjs
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -103,7 +107,7 @@ function createFetchOrquestrator({
|
|
|
103
107
|
const id = getAutoIncrementId();
|
|
104
108
|
lastFetchIdStarted = id;
|
|
105
109
|
lastFetchWasAborted = false;
|
|
106
|
-
fetchs.a = { startTime, onEnd: [] };
|
|
110
|
+
fetchs.a = { startTime, onEnd: [], rtuOnEnd: null };
|
|
107
111
|
const prevFetchStartTime = lastFetchStartTime;
|
|
108
112
|
lastFetchStartTime = startTime;
|
|
109
113
|
function shouldAbort() {
|
|
@@ -131,10 +135,14 @@ function createFetchOrquestrator({
|
|
|
131
135
|
fetchs.b = null;
|
|
132
136
|
}
|
|
133
137
|
const onEnd = currentFetchs.a.onEnd;
|
|
138
|
+
const rtuOnEnd = currentFetchs.a.rtuOnEnd;
|
|
134
139
|
currentFetchs.a = null;
|
|
135
140
|
if (onEnd.length > 0) {
|
|
136
141
|
onEnd.forEach((cb) => cb());
|
|
137
142
|
}
|
|
143
|
+
if (rtuOnEnd) {
|
|
144
|
+
rtuOnEnd();
|
|
145
|
+
}
|
|
138
146
|
flushScheduledFetch();
|
|
139
147
|
return true;
|
|
140
148
|
}
|
|
@@ -213,9 +221,9 @@ function createFetchOrquestrator({
|
|
|
213
221
|
return true;
|
|
214
222
|
}
|
|
215
223
|
if (fetchs.a) {
|
|
216
|
-
fetchs.a.
|
|
224
|
+
fetchs.a.rtuOnEnd = () => {
|
|
217
225
|
addDelayedRTU(Date.now(), params);
|
|
218
|
-
}
|
|
226
|
+
};
|
|
219
227
|
return true;
|
|
220
228
|
} else if (mutationIsInProgress) {
|
|
221
229
|
onMutationEnd.push(() => {
|
|
@@ -773,7 +781,7 @@ function newTSDFCollectionStore({
|
|
|
773
781
|
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
774
782
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
775
783
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
776
|
-
|
|
784
|
+
continue;
|
|
777
785
|
store.produceState(
|
|
778
786
|
(draft) => {
|
|
779
787
|
const draftItem = draft[itemKey];
|
|
@@ -919,6 +927,7 @@ function newTSDFCollectionStore({
|
|
|
919
927
|
itemStateKey: "",
|
|
920
928
|
isLoading: false
|
|
921
929
|
},
|
|
930
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
922
931
|
[item]
|
|
923
932
|
);
|
|
924
933
|
const [useModifyResult, emitIsLoadedEvt] = useEnsureIsLoaded(
|
|
@@ -1327,7 +1336,7 @@ function newTSDFListQueryStore({
|
|
|
1327
1336
|
const currentInvalidationPriority = queryState.refetchOnMount ? fetchTypePriority[queryState.refetchOnMount] : -1;
|
|
1328
1337
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1329
1338
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1330
|
-
|
|
1339
|
+
continue;
|
|
1331
1340
|
store.produceState(
|
|
1332
1341
|
(draft) => {
|
|
1333
1342
|
const query = draft.queries[key];
|
|
@@ -1629,7 +1638,7 @@ function newTSDFListQueryStore({
|
|
|
1629
1638
|
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
1630
1639
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1631
1640
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1632
|
-
|
|
1641
|
+
continue;
|
|
1633
1642
|
store.produceState(
|
|
1634
1643
|
(draft) => {
|
|
1635
1644
|
const query = draft.itemQueries[itemKey];
|
package/dist/main.js
CHANGED
|
@@ -69,7 +69,7 @@ function createFetchOrquestrator({
|
|
|
69
69
|
const id = getAutoIncrementId();
|
|
70
70
|
lastFetchIdStarted = id;
|
|
71
71
|
lastFetchWasAborted = false;
|
|
72
|
-
fetchs.a = { startTime, onEnd: [] };
|
|
72
|
+
fetchs.a = { startTime, onEnd: [], rtuOnEnd: null };
|
|
73
73
|
const prevFetchStartTime = lastFetchStartTime;
|
|
74
74
|
lastFetchStartTime = startTime;
|
|
75
75
|
function shouldAbort() {
|
|
@@ -97,10 +97,14 @@ function createFetchOrquestrator({
|
|
|
97
97
|
fetchs.b = null;
|
|
98
98
|
}
|
|
99
99
|
const onEnd = currentFetchs.a.onEnd;
|
|
100
|
+
const rtuOnEnd = currentFetchs.a.rtuOnEnd;
|
|
100
101
|
currentFetchs.a = null;
|
|
101
102
|
if (onEnd.length > 0) {
|
|
102
103
|
onEnd.forEach((cb) => cb());
|
|
103
104
|
}
|
|
105
|
+
if (rtuOnEnd) {
|
|
106
|
+
rtuOnEnd();
|
|
107
|
+
}
|
|
104
108
|
flushScheduledFetch();
|
|
105
109
|
return true;
|
|
106
110
|
}
|
|
@@ -179,9 +183,9 @@ function createFetchOrquestrator({
|
|
|
179
183
|
return true;
|
|
180
184
|
}
|
|
181
185
|
if (fetchs.a) {
|
|
182
|
-
fetchs.a.
|
|
186
|
+
fetchs.a.rtuOnEnd = () => {
|
|
183
187
|
addDelayedRTU(Date.now(), params);
|
|
184
|
-
}
|
|
188
|
+
};
|
|
185
189
|
return true;
|
|
186
190
|
} else if (mutationIsInProgress) {
|
|
187
191
|
onMutationEnd.push(() => {
|
|
@@ -739,7 +743,7 @@ function newTSDFCollectionStore({
|
|
|
739
743
|
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
740
744
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
741
745
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
742
|
-
|
|
746
|
+
continue;
|
|
743
747
|
store.produceState(
|
|
744
748
|
(draft) => {
|
|
745
749
|
const draftItem = draft[itemKey];
|
|
@@ -885,6 +889,7 @@ function newTSDFCollectionStore({
|
|
|
885
889
|
itemStateKey: "",
|
|
886
890
|
isLoading: false
|
|
887
891
|
},
|
|
892
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
888
893
|
[item]
|
|
889
894
|
);
|
|
890
895
|
const [useModifyResult, emitIsLoadedEvt] = useEnsureIsLoaded(
|
|
@@ -1293,7 +1298,7 @@ function newTSDFListQueryStore({
|
|
|
1293
1298
|
const currentInvalidationPriority = queryState.refetchOnMount ? fetchTypePriority[queryState.refetchOnMount] : -1;
|
|
1294
1299
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1295
1300
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1296
|
-
|
|
1301
|
+
continue;
|
|
1297
1302
|
store.produceState(
|
|
1298
1303
|
(draft) => {
|
|
1299
1304
|
const query = draft.queries[key];
|
|
@@ -1595,7 +1600,7 @@ function newTSDFListQueryStore({
|
|
|
1595
1600
|
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
1596
1601
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1597
1602
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1598
|
-
|
|
1603
|
+
continue;
|
|
1599
1604
|
store.produceState(
|
|
1600
1605
|
(draft) => {
|
|
1601
1606
|
const query = draft.itemQueries[itemKey];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdf",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.2",
|
|
4
4
|
"description": "A data fetching solution based on t-state",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lucas Santos",
|
|
@@ -58,16 +58,16 @@
|
|
|
58
58
|
"react-dom": "^18.2.0",
|
|
59
59
|
"tiny-glob": "^0.2.9",
|
|
60
60
|
"tsm": "^2.3.0",
|
|
61
|
-
"tsup": "^6.
|
|
62
|
-
"typescript": "^
|
|
63
|
-
"vite": "^4.
|
|
64
|
-
"vitest": "^0.
|
|
61
|
+
"tsup": "^6.7.0",
|
|
62
|
+
"typescript": "^5.0.4",
|
|
63
|
+
"vite": "^4.2.1",
|
|
64
|
+
"vitest": "^0.30.1"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"immer": "^9.0.17",
|
|
68
68
|
"klona": "^2.0.6",
|
|
69
69
|
"mitt": "^3.0.0",
|
|
70
|
-
"t-state": "^8.
|
|
70
|
+
"t-state": "^8.3.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"react": "^18.0.0",
|