tsdf 8.0.0-beta.11 → 8.0.0-beta.12
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 +35 -3
- package/dist/main.js +35 -3
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -269,6 +269,13 @@ function getAutoIncrementId() {
|
|
|
269
269
|
return ++autoIncrementId;
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
+
// src/storeShared.ts
|
|
273
|
+
var fetchTypePriority = {
|
|
274
|
+
lowPriority: 0,
|
|
275
|
+
realtimeUpdate: 1,
|
|
276
|
+
highPriority: 2
|
|
277
|
+
};
|
|
278
|
+
|
|
272
279
|
// src/useEnsureIsLoaded.ts
|
|
273
280
|
var import_mitt = __toESM(require("mitt"), 1);
|
|
274
281
|
var import_react2 = require("react");
|
|
@@ -465,6 +472,10 @@ function newTSDFDocumentStore({
|
|
|
465
472
|
const storeEvents = (0, import_mitt2.default)();
|
|
466
473
|
let invalidationWasTriggered = false;
|
|
467
474
|
function invalidateData(priority = "highPriority") {
|
|
475
|
+
const currentInvalidationPriority = store.state.refetchOnMount ? fetchTypePriority[store.state.refetchOnMount] : -1;
|
|
476
|
+
const newInvalidationPriority = fetchTypePriority[priority];
|
|
477
|
+
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
478
|
+
return;
|
|
468
479
|
store.setKey("refetchOnMount", priority, { action: "invalidate-data" });
|
|
469
480
|
invalidationWasTriggered = false;
|
|
470
481
|
storeEvents.emit("invalidateData", priority);
|
|
@@ -765,12 +776,19 @@ function newTSDFCollectionStore({
|
|
|
765
776
|
function invalidateItem(itemPayload, priority = "highPriority") {
|
|
766
777
|
const itemsKey = getItemsKeyArray(itemPayload);
|
|
767
778
|
for (const itemKey of itemsKey) {
|
|
779
|
+
const item = store.state[itemKey];
|
|
780
|
+
if (!item)
|
|
781
|
+
continue;
|
|
782
|
+
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
783
|
+
const newInvalidationPriority = fetchTypePriority[priority];
|
|
784
|
+
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
785
|
+
return;
|
|
768
786
|
store.produceState(
|
|
769
787
|
(draft) => {
|
|
770
|
-
const
|
|
771
|
-
if (!
|
|
788
|
+
const draftItem = draft[itemKey];
|
|
789
|
+
if (!draftItem)
|
|
772
790
|
return;
|
|
773
|
-
|
|
791
|
+
draftItem.refetchOnMount = priority;
|
|
774
792
|
},
|
|
775
793
|
{ action: { type: "invalidate-data", itemKey } }
|
|
776
794
|
);
|
|
@@ -1282,6 +1300,13 @@ function newTSDFListQueryStore({
|
|
|
1282
1300
|
function invalidateQuery(queryPayload, priority = "highPriority", ignoreInvalidationSync = false) {
|
|
1283
1301
|
const queriesKey = getQueriesKeyArray(queryPayload);
|
|
1284
1302
|
for (const { key } of queriesKey) {
|
|
1303
|
+
const queryState = store.state.queries[key];
|
|
1304
|
+
if (!queryState)
|
|
1305
|
+
continue;
|
|
1306
|
+
const currentInvalidationPriority = queryState.refetchOnMount ? fetchTypePriority[queryState.refetchOnMount] : -1;
|
|
1307
|
+
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1308
|
+
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1309
|
+
return;
|
|
1285
1310
|
store.produceState(
|
|
1286
1311
|
(draft) => {
|
|
1287
1312
|
const query = draft.queries[key];
|
|
@@ -1571,6 +1596,13 @@ function newTSDFListQueryStore({
|
|
|
1571
1596
|
}
|
|
1572
1597
|
const itemsKey = getItemsKeyArray(itemId);
|
|
1573
1598
|
for (const { itemKey } of itemsKey) {
|
|
1599
|
+
const item = store.state.itemQueries[itemKey];
|
|
1600
|
+
if (!item)
|
|
1601
|
+
continue;
|
|
1602
|
+
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
1603
|
+
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1604
|
+
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1605
|
+
return;
|
|
1574
1606
|
store.produceState(
|
|
1575
1607
|
(draft) => {
|
|
1576
1608
|
const query = draft.itemQueries[itemKey];
|
package/dist/main.js
CHANGED
|
@@ -235,6 +235,13 @@ function getAutoIncrementId() {
|
|
|
235
235
|
return ++autoIncrementId;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
// src/storeShared.ts
|
|
239
|
+
var fetchTypePriority = {
|
|
240
|
+
lowPriority: 0,
|
|
241
|
+
realtimeUpdate: 1,
|
|
242
|
+
highPriority: 2
|
|
243
|
+
};
|
|
244
|
+
|
|
238
245
|
// src/useEnsureIsLoaded.ts
|
|
239
246
|
import mitt from "mitt";
|
|
240
247
|
import { useMemo as useMemo2, useState } from "react";
|
|
@@ -431,6 +438,10 @@ function newTSDFDocumentStore({
|
|
|
431
438
|
const storeEvents = mitt2();
|
|
432
439
|
let invalidationWasTriggered = false;
|
|
433
440
|
function invalidateData(priority = "highPriority") {
|
|
441
|
+
const currentInvalidationPriority = store.state.refetchOnMount ? fetchTypePriority[store.state.refetchOnMount] : -1;
|
|
442
|
+
const newInvalidationPriority = fetchTypePriority[priority];
|
|
443
|
+
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
444
|
+
return;
|
|
434
445
|
store.setKey("refetchOnMount", priority, { action: "invalidate-data" });
|
|
435
446
|
invalidationWasTriggered = false;
|
|
436
447
|
storeEvents.emit("invalidateData", priority);
|
|
@@ -731,12 +742,19 @@ function newTSDFCollectionStore({
|
|
|
731
742
|
function invalidateItem(itemPayload, priority = "highPriority") {
|
|
732
743
|
const itemsKey = getItemsKeyArray(itemPayload);
|
|
733
744
|
for (const itemKey of itemsKey) {
|
|
745
|
+
const item = store.state[itemKey];
|
|
746
|
+
if (!item)
|
|
747
|
+
continue;
|
|
748
|
+
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
749
|
+
const newInvalidationPriority = fetchTypePriority[priority];
|
|
750
|
+
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
751
|
+
return;
|
|
734
752
|
store.produceState(
|
|
735
753
|
(draft) => {
|
|
736
|
-
const
|
|
737
|
-
if (!
|
|
754
|
+
const draftItem = draft[itemKey];
|
|
755
|
+
if (!draftItem)
|
|
738
756
|
return;
|
|
739
|
-
|
|
757
|
+
draftItem.refetchOnMount = priority;
|
|
740
758
|
},
|
|
741
759
|
{ action: { type: "invalidate-data", itemKey } }
|
|
742
760
|
);
|
|
@@ -1248,6 +1266,13 @@ function newTSDFListQueryStore({
|
|
|
1248
1266
|
function invalidateQuery(queryPayload, priority = "highPriority", ignoreInvalidationSync = false) {
|
|
1249
1267
|
const queriesKey = getQueriesKeyArray(queryPayload);
|
|
1250
1268
|
for (const { key } of queriesKey) {
|
|
1269
|
+
const queryState = store.state.queries[key];
|
|
1270
|
+
if (!queryState)
|
|
1271
|
+
continue;
|
|
1272
|
+
const currentInvalidationPriority = queryState.refetchOnMount ? fetchTypePriority[queryState.refetchOnMount] : -1;
|
|
1273
|
+
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1274
|
+
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1275
|
+
return;
|
|
1251
1276
|
store.produceState(
|
|
1252
1277
|
(draft) => {
|
|
1253
1278
|
const query = draft.queries[key];
|
|
@@ -1537,6 +1562,13 @@ function newTSDFListQueryStore({
|
|
|
1537
1562
|
}
|
|
1538
1563
|
const itemsKey = getItemsKeyArray(itemId);
|
|
1539
1564
|
for (const { itemKey } of itemsKey) {
|
|
1565
|
+
const item = store.state.itemQueries[itemKey];
|
|
1566
|
+
if (!item)
|
|
1567
|
+
continue;
|
|
1568
|
+
const currentInvalidationPriority = item.refetchOnMount ? fetchTypePriority[item.refetchOnMount] : -1;
|
|
1569
|
+
const newInvalidationPriority = fetchTypePriority[priority];
|
|
1570
|
+
if (currentInvalidationPriority >= newInvalidationPriority)
|
|
1571
|
+
return;
|
|
1540
1572
|
store.produceState(
|
|
1541
1573
|
(draft) => {
|
|
1542
1574
|
const query = draft.itemQueries[itemKey];
|