enlace 0.0.1-beta.12 → 0.0.1-beta.13
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/hook/index.js +20 -17
- package/dist/hook/index.mjs +20 -17
- package/package.json +1 -1
package/dist/hook/index.js
CHANGED
|
@@ -52,6 +52,13 @@ function hookReducer(state, action) {
|
|
|
52
52
|
fetching: true,
|
|
53
53
|
error: void 0
|
|
54
54
|
};
|
|
55
|
+
case "MUTATION_START":
|
|
56
|
+
return {
|
|
57
|
+
...state,
|
|
58
|
+
loading: true,
|
|
59
|
+
fetching: true,
|
|
60
|
+
error: void 0
|
|
61
|
+
};
|
|
55
62
|
case "FETCH_SUCCESS":
|
|
56
63
|
return {
|
|
57
64
|
loading: false,
|
|
@@ -239,23 +246,19 @@ function useQueryMode(api, trackedCall, options) {
|
|
|
239
246
|
}
|
|
240
247
|
const method = current[trackedCall.method];
|
|
241
248
|
const fetchPromise = method(trackedCall.options).then((res) => {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
});
|
|
249
|
-
}
|
|
249
|
+
setCache(queryKey, {
|
|
250
|
+
data: res.error ? void 0 : res.data,
|
|
251
|
+
error: res.error,
|
|
252
|
+
timestamp: Date.now(),
|
|
253
|
+
tags: queryTags
|
|
254
|
+
});
|
|
250
255
|
}).catch((err) => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
});
|
|
258
|
-
}
|
|
256
|
+
setCache(queryKey, {
|
|
257
|
+
data: void 0,
|
|
258
|
+
error: err,
|
|
259
|
+
timestamp: Date.now(),
|
|
260
|
+
tags: queryTags
|
|
261
|
+
});
|
|
259
262
|
});
|
|
260
263
|
setCache(queryKey, {
|
|
261
264
|
promise: fetchPromise,
|
|
@@ -359,7 +362,7 @@ function useSelectorMode(config) {
|
|
|
359
362
|
autoRevalidateRef.current = autoRevalidateTags;
|
|
360
363
|
if (!triggerRef.current) {
|
|
361
364
|
triggerRef.current = (async (...args) => {
|
|
362
|
-
dispatch({ type: "
|
|
365
|
+
dispatch({ type: "MUTATION_START" });
|
|
363
366
|
const options = args[0];
|
|
364
367
|
const resolvedPath = resolvePath2(pathRef.current, options?.params);
|
|
365
368
|
let res;
|
package/dist/hook/index.mjs
CHANGED
|
@@ -27,6 +27,13 @@ function hookReducer(state, action) {
|
|
|
27
27
|
fetching: true,
|
|
28
28
|
error: void 0
|
|
29
29
|
};
|
|
30
|
+
case "MUTATION_START":
|
|
31
|
+
return {
|
|
32
|
+
...state,
|
|
33
|
+
loading: true,
|
|
34
|
+
fetching: true,
|
|
35
|
+
error: void 0
|
|
36
|
+
};
|
|
30
37
|
case "FETCH_SUCCESS":
|
|
31
38
|
return {
|
|
32
39
|
loading: false,
|
|
@@ -214,23 +221,19 @@ function useQueryMode(api, trackedCall, options) {
|
|
|
214
221
|
}
|
|
215
222
|
const method = current[trackedCall.method];
|
|
216
223
|
const fetchPromise = method(trackedCall.options).then((res) => {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
});
|
|
224
|
-
}
|
|
224
|
+
setCache(queryKey, {
|
|
225
|
+
data: res.error ? void 0 : res.data,
|
|
226
|
+
error: res.error,
|
|
227
|
+
timestamp: Date.now(),
|
|
228
|
+
tags: queryTags
|
|
229
|
+
});
|
|
225
230
|
}).catch((err) => {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
});
|
|
233
|
-
}
|
|
231
|
+
setCache(queryKey, {
|
|
232
|
+
data: void 0,
|
|
233
|
+
error: err,
|
|
234
|
+
timestamp: Date.now(),
|
|
235
|
+
tags: queryTags
|
|
236
|
+
});
|
|
234
237
|
});
|
|
235
238
|
setCache(queryKey, {
|
|
236
239
|
promise: fetchPromise,
|
|
@@ -334,7 +337,7 @@ function useSelectorMode(config) {
|
|
|
334
337
|
autoRevalidateRef.current = autoRevalidateTags;
|
|
335
338
|
if (!triggerRef.current) {
|
|
336
339
|
triggerRef.current = (async (...args) => {
|
|
337
|
-
dispatch({ type: "
|
|
340
|
+
dispatch({ type: "MUTATION_START" });
|
|
338
341
|
const options = args[0];
|
|
339
342
|
const resolvedPath = resolvePath2(pathRef.current, options?.params);
|
|
340
343
|
let res;
|