@pinia/colada-plugin-delay 0.1.2 → 0.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/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -11
- package/dist/index.d.mts +29 -1
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -41,7 +41,7 @@ function* find$1(map, partialKey) {
|
|
|
41
41
|
*
|
|
42
42
|
* @internal
|
|
43
43
|
*/
|
|
44
|
-
const START_EXT = {};
|
|
44
|
+
const START_EXT = Object.freeze({});
|
|
45
45
|
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region ../../src/define-query-options.ts
|
|
@@ -194,7 +194,7 @@ const useQueryCache = /* @__PURE__ */ (0, pinia.defineStore)(QUERY_STORE_ID, ({
|
|
|
194
194
|
* @param [options] - options attached to the query
|
|
195
195
|
* @param [initialData] - initial data of the query if any
|
|
196
196
|
* @param [error] - initial error of the query if any
|
|
197
|
-
* @param [when] - relative when was the data or error fetched (will be
|
|
197
|
+
* @param [when] - relative when was the data or error fetched (will be substracted to Date.now())
|
|
198
198
|
* @param [meta] - resolved meta information for the query
|
|
199
199
|
*/
|
|
200
200
|
const create$1 = action((key, options = null, initialData, error = null, when = 0, meta = {}) => scope.run(() => {
|
|
@@ -351,7 +351,8 @@ const useQueryCache = /* @__PURE__ */ (0, pinia.defineStore)(QUERY_STORE_ID, ({
|
|
|
351
351
|
if (previousEntry && keyHash === previousEntry.keyHash) return previousEntry;
|
|
352
352
|
let entry = cachesRaw.get(keyHash);
|
|
353
353
|
if (!entry) {
|
|
354
|
-
|
|
354
|
+
const initialDataUpdatedAt = (0, vue.toValue)(options.initialDataUpdatedAt);
|
|
355
|
+
cachesRaw.set(keyHash, entry = create$1(key, options, options.initialData?.(), null, initialDataUpdatedAt != null ? Date.now() - initialDataUpdatedAt : 0, (0, vue.toValue)(options.meta)));
|
|
355
356
|
if (options.placeholderData && entry.state.value.status === "pending") entry.placeholderData = toValueWithArgs(options.placeholderData, isEntryUsingPlaceholderData(previousEntry) ? previousEntry.placeholderData : previousEntry?.state.value.data);
|
|
356
357
|
(0, vue.triggerRef)(caches);
|
|
357
358
|
}
|