tsdf 11.0.0 → 11.1.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.cjs +22 -3
- package/dist/main.js +22 -3
- package/package.json +2 -2
package/dist/main.cjs
CHANGED
|
@@ -512,6 +512,7 @@ function newTSDFDocumentStore({
|
|
|
512
512
|
});
|
|
513
513
|
useOnMittEvent(storeEvents, "invalidateData", (priority) => {
|
|
514
514
|
if (!invalidationWasTriggered) {
|
|
515
|
+
store.setKey("refetchOnMount", false);
|
|
515
516
|
scheduleFetch(priority);
|
|
516
517
|
invalidationWasTriggered = true;
|
|
517
518
|
}
|
|
@@ -772,7 +773,7 @@ function newTSDFCollectionStore({
|
|
|
772
773
|
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
773
774
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
774
775
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
775
|
-
|
|
776
|
+
continue;
|
|
776
777
|
store.produceState(
|
|
777
778
|
(draft) => {
|
|
778
779
|
const draftItem = draft[itemKey];
|
|
@@ -872,6 +873,12 @@ function newTSDFCollectionStore({
|
|
|
872
873
|
if (itemKey !== event.itemKey)
|
|
873
874
|
continue;
|
|
874
875
|
if (!invalidationWasTriggered.has(itemKey)) {
|
|
876
|
+
store.produceState((draft) => {
|
|
877
|
+
const draftItem = draft[itemKey];
|
|
878
|
+
if (!draftItem)
|
|
879
|
+
return;
|
|
880
|
+
draftItem.refetchOnMount = false;
|
|
881
|
+
});
|
|
875
882
|
scheduleFetch(event.priority, payload);
|
|
876
883
|
invalidationWasTriggered.add(itemKey);
|
|
877
884
|
}
|
|
@@ -1320,7 +1327,7 @@ function newTSDFListQueryStore({
|
|
|
1320
1327
|
const currentInvalidationPriority = queryState.refetchOnMount ? fetchTypePriority[queryState.refetchOnMount] : -1;
|
|
1321
1328
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1322
1329
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1323
|
-
|
|
1330
|
+
continue;
|
|
1324
1331
|
store.produceState(
|
|
1325
1332
|
(draft) => {
|
|
1326
1333
|
const query = draft.queries[key];
|
|
@@ -1430,6 +1437,12 @@ function newTSDFListQueryStore({
|
|
|
1430
1437
|
if (key !== event.queryKey)
|
|
1431
1438
|
continue;
|
|
1432
1439
|
if (!queryInvalidationWasTriggered.has(key)) {
|
|
1440
|
+
store.produceState((draft) => {
|
|
1441
|
+
const query = draft.queries[key];
|
|
1442
|
+
if (!query?.refetchOnMount)
|
|
1443
|
+
return;
|
|
1444
|
+
query.refetchOnMount = false;
|
|
1445
|
+
});
|
|
1433
1446
|
scheduleListQueryFetch(event.priority, payload);
|
|
1434
1447
|
queryInvalidationWasTriggered.add(key);
|
|
1435
1448
|
}
|
|
@@ -1616,7 +1629,7 @@ function newTSDFListQueryStore({
|
|
|
1616
1629
|
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
1617
1630
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1618
1631
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1619
|
-
|
|
1632
|
+
continue;
|
|
1620
1633
|
store.produceState(
|
|
1621
1634
|
(draft) => {
|
|
1622
1635
|
const query = draft.itemQueries[itemKey];
|
|
@@ -1745,6 +1758,12 @@ function newTSDFListQueryStore({
|
|
|
1745
1758
|
if (itemKey !== event.itemKey)
|
|
1746
1759
|
continue;
|
|
1747
1760
|
if (!itemInvalidationWasTriggered.has(itemKey)) {
|
|
1761
|
+
store.produceState((draft) => {
|
|
1762
|
+
const query = draft.itemQueries[itemKey];
|
|
1763
|
+
if (!query?.refetchOnMount)
|
|
1764
|
+
return;
|
|
1765
|
+
query.refetchOnMount = false;
|
|
1766
|
+
});
|
|
1748
1767
|
scheduleItemFetch(event.priority, payload);
|
|
1749
1768
|
itemInvalidationWasTriggered.add(itemKey);
|
|
1750
1769
|
}
|
package/dist/main.js
CHANGED
|
@@ -478,6 +478,7 @@ function newTSDFDocumentStore({
|
|
|
478
478
|
});
|
|
479
479
|
useOnMittEvent(storeEvents, "invalidateData", (priority) => {
|
|
480
480
|
if (!invalidationWasTriggered) {
|
|
481
|
+
store.setKey("refetchOnMount", false);
|
|
481
482
|
scheduleFetch(priority);
|
|
482
483
|
invalidationWasTriggered = true;
|
|
483
484
|
}
|
|
@@ -738,7 +739,7 @@ function newTSDFCollectionStore({
|
|
|
738
739
|
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
739
740
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
740
741
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
741
|
-
|
|
742
|
+
continue;
|
|
742
743
|
store.produceState(
|
|
743
744
|
(draft) => {
|
|
744
745
|
const draftItem = draft[itemKey];
|
|
@@ -838,6 +839,12 @@ function newTSDFCollectionStore({
|
|
|
838
839
|
if (itemKey !== event.itemKey)
|
|
839
840
|
continue;
|
|
840
841
|
if (!invalidationWasTriggered.has(itemKey)) {
|
|
842
|
+
store.produceState((draft) => {
|
|
843
|
+
const draftItem = draft[itemKey];
|
|
844
|
+
if (!draftItem)
|
|
845
|
+
return;
|
|
846
|
+
draftItem.refetchOnMount = false;
|
|
847
|
+
});
|
|
841
848
|
scheduleFetch(event.priority, payload);
|
|
842
849
|
invalidationWasTriggered.add(itemKey);
|
|
843
850
|
}
|
|
@@ -1286,7 +1293,7 @@ function newTSDFListQueryStore({
|
|
|
1286
1293
|
const currentInvalidationPriority = queryState.refetchOnMount ? fetchTypePriority[queryState.refetchOnMount] : -1;
|
|
1287
1294
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1288
1295
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1289
|
-
|
|
1296
|
+
continue;
|
|
1290
1297
|
store.produceState(
|
|
1291
1298
|
(draft) => {
|
|
1292
1299
|
const query = draft.queries[key];
|
|
@@ -1396,6 +1403,12 @@ function newTSDFListQueryStore({
|
|
|
1396
1403
|
if (key !== event.queryKey)
|
|
1397
1404
|
continue;
|
|
1398
1405
|
if (!queryInvalidationWasTriggered.has(key)) {
|
|
1406
|
+
store.produceState((draft) => {
|
|
1407
|
+
const query = draft.queries[key];
|
|
1408
|
+
if (!query?.refetchOnMount)
|
|
1409
|
+
return;
|
|
1410
|
+
query.refetchOnMount = false;
|
|
1411
|
+
});
|
|
1399
1412
|
scheduleListQueryFetch(event.priority, payload);
|
|
1400
1413
|
queryInvalidationWasTriggered.add(key);
|
|
1401
1414
|
}
|
|
@@ -1582,7 +1595,7 @@ function newTSDFListQueryStore({
|
|
|
1582
1595
|
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
1583
1596
|
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1584
1597
|
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1585
|
-
|
|
1598
|
+
continue;
|
|
1586
1599
|
store.produceState(
|
|
1587
1600
|
(draft) => {
|
|
1588
1601
|
const query = draft.itemQueries[itemKey];
|
|
@@ -1711,6 +1724,12 @@ function newTSDFListQueryStore({
|
|
|
1711
1724
|
if (itemKey !== event.itemKey)
|
|
1712
1725
|
continue;
|
|
1713
1726
|
if (!itemInvalidationWasTriggered.has(itemKey)) {
|
|
1727
|
+
store.produceState((draft) => {
|
|
1728
|
+
const query = draft.itemQueries[itemKey];
|
|
1729
|
+
if (!query?.refetchOnMount)
|
|
1730
|
+
return;
|
|
1731
|
+
query.refetchOnMount = false;
|
|
1732
|
+
});
|
|
1714
1733
|
scheduleItemFetch(event.priority, payload);
|
|
1715
1734
|
itemInvalidationWasTriggered.add(itemKey);
|
|
1716
1735
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdf",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.1.1",
|
|
4
4
|
"description": "A data fetching solution based on t-state",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lucas Santos",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"tsup": "^6.5.0",
|
|
62
62
|
"typescript": "^4.9.4",
|
|
63
63
|
"vite": "^4.0.4",
|
|
64
|
-
"vitest": "^0.
|
|
64
|
+
"vitest": "^0.29.3"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"immer": "^9.0.17",
|