@spoosh/core 0.8.0 → 0.8.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/index.js +17 -8
- package/dist/index.mjs +17 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -664,13 +664,20 @@ function createStateManager() {
|
|
|
664
664
|
return entries;
|
|
665
665
|
},
|
|
666
666
|
setMeta(key, data) {
|
|
667
|
-
|
|
668
|
-
if (entry) {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
667
|
+
let entry = cache.get(key);
|
|
668
|
+
if (!entry) {
|
|
669
|
+
entry = {
|
|
670
|
+
state: createInitialState(),
|
|
671
|
+
tags: [],
|
|
672
|
+
meta: /* @__PURE__ */ new Map(),
|
|
673
|
+
selfTag: generateSelfTagFromKey(key)
|
|
674
|
+
};
|
|
675
|
+
cache.set(key, entry);
|
|
673
676
|
}
|
|
677
|
+
for (const [name, value] of Object.entries(data)) {
|
|
678
|
+
entry.meta.set(name, value);
|
|
679
|
+
}
|
|
680
|
+
notifySubscribers(key);
|
|
674
681
|
},
|
|
675
682
|
markStale(tags) {
|
|
676
683
|
cache.forEach((entry) => {
|
|
@@ -1147,12 +1154,14 @@ function createOperationController(options) {
|
|
|
1147
1154
|
const cached = stateManager.getCache(queryKey);
|
|
1148
1155
|
if (cached) {
|
|
1149
1156
|
stateManager.setCache(queryKey, {
|
|
1150
|
-
state: { ...cached.state, ...updater }
|
|
1157
|
+
state: { ...cached.state, ...updater },
|
|
1158
|
+
stale: false
|
|
1151
1159
|
});
|
|
1152
1160
|
} else {
|
|
1153
1161
|
stateManager.setCache(queryKey, {
|
|
1154
1162
|
state: { ...createInitialState(), ...updater },
|
|
1155
|
-
tags
|
|
1163
|
+
tags,
|
|
1164
|
+
stale: false
|
|
1156
1165
|
});
|
|
1157
1166
|
}
|
|
1158
1167
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -608,13 +608,20 @@ function createStateManager() {
|
|
|
608
608
|
return entries;
|
|
609
609
|
},
|
|
610
610
|
setMeta(key, data) {
|
|
611
|
-
|
|
612
|
-
if (entry) {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
611
|
+
let entry = cache.get(key);
|
|
612
|
+
if (!entry) {
|
|
613
|
+
entry = {
|
|
614
|
+
state: createInitialState(),
|
|
615
|
+
tags: [],
|
|
616
|
+
meta: /* @__PURE__ */ new Map(),
|
|
617
|
+
selfTag: generateSelfTagFromKey(key)
|
|
618
|
+
};
|
|
619
|
+
cache.set(key, entry);
|
|
617
620
|
}
|
|
621
|
+
for (const [name, value] of Object.entries(data)) {
|
|
622
|
+
entry.meta.set(name, value);
|
|
623
|
+
}
|
|
624
|
+
notifySubscribers(key);
|
|
618
625
|
},
|
|
619
626
|
markStale(tags) {
|
|
620
627
|
cache.forEach((entry) => {
|
|
@@ -1091,12 +1098,14 @@ function createOperationController(options) {
|
|
|
1091
1098
|
const cached = stateManager.getCache(queryKey);
|
|
1092
1099
|
if (cached) {
|
|
1093
1100
|
stateManager.setCache(queryKey, {
|
|
1094
|
-
state: { ...cached.state, ...updater }
|
|
1101
|
+
state: { ...cached.state, ...updater },
|
|
1102
|
+
stale: false
|
|
1095
1103
|
});
|
|
1096
1104
|
} else {
|
|
1097
1105
|
stateManager.setCache(queryKey, {
|
|
1098
1106
|
state: { ...createInitialState(), ...updater },
|
|
1099
|
-
tags
|
|
1107
|
+
tags,
|
|
1108
|
+
stale: false
|
|
1100
1109
|
});
|
|
1101
1110
|
}
|
|
1102
1111
|
};
|