react-redux-cache 0.18.0 → 0.18.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/query.js +2 -6
- package/package.json +1 -1
package/dist/query.js
CHANGED
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.query = void 0;
|
|
13
|
-
const cache_1 = require("./testing/redux/cache");
|
|
14
13
|
const utilsAndConstants_1 = require("./utilsAndConstants");
|
|
15
14
|
const query = (logTag, store, cache, actions, selectors, queryKey, cacheKey, params, secondsToLive, onlyIfExpired, mergeResults, onCompleted, onSuccess, onError) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
15
|
var _a, _b, _c, _d;
|
|
@@ -19,11 +18,9 @@ const query = (logTag, store, cache, actions, selectors, queryKey, cacheKey, par
|
|
|
19
18
|
if (onCompleted === void 0) { onCompleted = cache.queries[queryKey].onCompleted; }
|
|
20
19
|
if (onSuccess === void 0) { onSuccess = cache.queries[queryKey].onSuccess; }
|
|
21
20
|
if (onError === void 0) { onError = cache.queries[queryKey].onError; }
|
|
22
|
-
const { selectQueryResult } = selectors;
|
|
21
|
+
const { selectQueryResult, selectQueryState } = selectors;
|
|
23
22
|
const logsEnabled = cache.options.logsEnabled;
|
|
24
|
-
const queryStateOnStart =
|
|
25
|
-
// @ts-expect-error TODO fix types
|
|
26
|
-
queryKey, cacheKey);
|
|
23
|
+
const queryStateOnStart = selectQueryState(store.getState(), queryKey, cacheKey);
|
|
27
24
|
if (queryStateOnStart === null || queryStateOnStart === void 0 ? void 0 : queryStateOnStart.loading) {
|
|
28
25
|
logsEnabled &&
|
|
29
26
|
(0, utilsAndConstants_1.log)(`${logTag} fetch cancelled: already loading`, {
|
|
@@ -52,7 +49,6 @@ const query = (logTag, store, cache, actions, selectors, queryKey, cacheKey, par
|
|
|
52
49
|
});
|
|
53
50
|
return {
|
|
54
51
|
cancelled: 'not-expired',
|
|
55
|
-
// @ts-expect-error TODO fix types
|
|
56
52
|
result: queryStateOnStart.result,
|
|
57
53
|
};
|
|
58
54
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "react-redux-cache",
|
|
3
3
|
"author": "Alexander Danilov",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.18.
|
|
5
|
+
"version": "0.18.1",
|
|
6
6
|
"description": "Powerful data fetching and caching library for Redux and Zustand that supports normalization.",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|