@depup/reduxjs__toolkit 2.12.0-depup.29 → 2.13.0-depup.0
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/README.md +2 -2
- package/changes.json +1 -1
- package/dist/cjs/redux-toolkit.development.cjs +1755 -2247
- package/dist/cjs/redux-toolkit.development.cjs.map +1 -1
- package/dist/cjs/redux-toolkit.production.min.cjs +1 -2
- package/dist/cjs/redux-toolkit.production.min.cjs.map +1 -1
- package/dist/index.d.mts +1496 -1525
- package/dist/index.d.ts +1496 -1525
- package/dist/query/cjs/rtk-query.development.cjs +2059 -2990
- package/dist/query/cjs/rtk-query.development.cjs.map +1 -1
- package/dist/query/cjs/rtk-query.production.min.cjs +1 -1
- package/dist/query/cjs/rtk-query.production.min.cjs.map +1 -1
- package/dist/query/index.d.mts +2300 -2308
- package/dist/query/index.d.ts +2300 -2308
- package/dist/query/react/cjs/rtk-query-react.development.cjs +609 -714
- package/dist/query/react/cjs/rtk-query-react.development.cjs.map +1 -1
- package/dist/query/react/cjs/rtk-query-react.production.min.cjs +1 -1
- package/dist/query/react/cjs/rtk-query-react.production.min.cjs.map +1 -1
- package/dist/query/react/index.d.mts +516 -523
- package/dist/query/react/index.d.ts +516 -523
- package/dist/query/react/rtk-query-react.browser.mjs +1 -1
- package/dist/query/react/rtk-query-react.browser.mjs.map +1 -1
- package/dist/query/react/rtk-query-react.legacy-esm.js +672 -714
- package/dist/query/react/rtk-query-react.legacy-esm.js.map +1 -1
- package/dist/query/react/rtk-query-react.modern.mjs +586 -679
- package/dist/query/react/rtk-query-react.modern.mjs.map +1 -1
- package/dist/query/rtk-query.browser.mjs +1 -1
- package/dist/query/rtk-query.browser.mjs.map +1 -1
- package/dist/query/rtk-query.legacy-esm.js +2175 -3014
- package/dist/query/rtk-query.legacy-esm.js.map +1 -1
- package/dist/query/rtk-query.modern.mjs +2052 -2949
- package/dist/query/rtk-query.modern.mjs.map +1 -1
- package/dist/react/cjs/redux-toolkit-react.development.cjs +30 -51
- package/dist/react/cjs/redux-toolkit-react.development.cjs.map +1 -1
- package/dist/react/cjs/redux-toolkit-react.production.min.cjs +1 -1
- package/dist/react/cjs/redux-toolkit-react.production.min.cjs.map +1 -1
- package/dist/react/index.d.mts +12 -15
- package/dist/react/index.d.ts +12 -15
- package/dist/react/redux-toolkit-react.browser.mjs +1 -1
- package/dist/react/redux-toolkit-react.browser.mjs.map +1 -1
- package/dist/react/redux-toolkit-react.legacy-esm.js +83 -44
- package/dist/react/redux-toolkit-react.legacy-esm.js.map +1 -1
- package/dist/react/redux-toolkit-react.modern.mjs +23 -25
- package/dist/react/redux-toolkit-react.modern.mjs.map +1 -1
- package/dist/redux-toolkit.browser.mjs +1 -2
- package/dist/redux-toolkit.browser.mjs.map +1 -1
- package/dist/redux-toolkit.legacy-esm.js +1748 -2201
- package/dist/redux-toolkit.legacy-esm.js.map +1 -1
- package/dist/redux-toolkit.modern.mjs +1670 -2171
- package/dist/redux-toolkit.modern.mjs.map +1 -1
- package/package.json +13 -29
- package/skills/build-modern-redux-apps/modern-redux/SKILL.md +23 -14
- package/skills/build-modern-redux-apps/modern-redux/references/store-lifetime.md +6 -6
- package/skills/build-modern-redux-apps/redux-dataflow/SKILL.md +13 -10
- package/skills/evolve-and-diagnose-redux-apps/debug-redux-toolkit-apps/SKILL.md +6 -6
- package/skills/evolve-and-diagnose-redux-apps/migrate-to-modern-redux/SKILL.md +7 -8
- package/skills/manage-server-data/adopt-rtk-query/SKILL.md +13 -11
- package/skills/model-redux-state/build-slices-and-selectors/SKILL.md +26 -14
- package/skills/model-redux-state/design-state-ownership/SKILL.md +11 -12
- package/skills/model-redux-state/design-state-ownership/references/state-ownership.md +6 -6
- package/skills/orchestrate-side-effects/handle-side-effects/SKILL.md +27 -23
- package/skills/orchestrate-side-effects/handle-side-effects/references/listener-workflows.md +4 -4
- package/src/autoBatchEnhancer.ts +5 -3
- package/src/combineSlices.ts +5 -5
- package/src/createAction.ts +11 -6
- package/src/createAsyncThunk.ts +14 -2
- package/src/createReducer.ts +1 -1
- package/src/createSlice.ts +9 -4
- package/src/dynamicMiddleware/index.ts +21 -5
- package/src/entities/models.ts +2 -1
- package/src/entities/sorted_state_adapter.ts +35 -24
- package/src/entities/unsorted_state_adapter.ts +1 -1
- package/src/immutableStateInvariantMiddleware.ts +34 -5
- package/src/listenerMiddleware/types.ts +10 -10
- package/src/mapBuilders.ts +2 -5
- package/src/matchers.ts +7 -1
- package/src/query/core/apiState.ts +1 -1
- package/src/query/core/buildInitiate.ts +19 -15
- package/src/query/core/buildMiddleware/cacheLifecycle.ts +3 -1
- package/src/query/core/buildMiddleware/index.ts +1 -1
- package/src/query/core/buildMiddleware/invalidationByTags.ts +4 -1
- package/src/query/core/buildMiddleware/polling.ts +12 -3
- package/src/query/core/buildMiddleware/types.ts +5 -2
- package/src/query/core/buildSlice.ts +2 -2
- package/src/query/core/buildThunks.ts +19 -0
- package/src/query/core/module.ts +9 -3
- package/src/query/createApi.ts +4 -1
- package/src/query/endpointDefinitions.ts +15 -9
- package/src/query/fetchBaseQuery.ts +1 -1
- package/src/query/react/buildHooks.ts +54 -51
- package/src/query/react/namedHooks.ts +28 -24
- package/src/query/utils/isAbsoluteUrl.ts +8 -3
- package/src/serializableStateInvariantMiddleware.ts +1 -1
|
@@ -1,740 +1,698 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// src/query/react/rtkqImports.ts
|
|
34
|
-
import { buildCreateApi, coreModule, copyWithStructuralSharing, setupListeners, QueryStatus, skipToken } from "@reduxjs/toolkit/query";
|
|
35
|
-
|
|
36
|
-
// src/query/react/module.ts
|
|
37
|
-
import { formatProdErrorMessage as _formatProdErrorMessage4 } from "@reduxjs/toolkit";
|
|
38
|
-
import { batch as rrBatch, useDispatch as rrUseDispatch, useSelector as rrUseSelector, useStore as rrUseStore } from "react-redux";
|
|
39
|
-
import { createSelector as _createSelector } from "reselect";
|
|
40
|
-
|
|
41
|
-
// src/query/utils/capitalize.ts
|
|
1
|
+
import { QueryStatus, buildCreateApi, copyWithStructuralSharing, coreModule, setupListeners, skipToken } from "@reduxjs/toolkit/query";
|
|
2
|
+
import { configureStore, formatProdErrorMessage } from "@reduxjs/toolkit";
|
|
3
|
+
import { Provider, ReactReduxContext, batch, shallowEqual, useDispatch, useSelector, useStore } from "react-redux";
|
|
4
|
+
import { createSelector } from "reselect";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { useCallback, useContext, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
export * from "@reduxjs/toolkit/query";
|
|
8
|
+
//#region src/query/utils/capitalize.ts
|
|
42
9
|
function capitalize(str) {
|
|
43
|
-
|
|
10
|
+
return str.replace(str[0], str[0].toUpperCase());
|
|
44
11
|
}
|
|
45
|
-
|
|
46
|
-
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/query/utils/countObjectKeys.ts
|
|
47
14
|
function countObjectKeys(obj) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
return count;
|
|
15
|
+
let count = 0;
|
|
16
|
+
for (const _key in obj) count++;
|
|
17
|
+
return count;
|
|
53
18
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/query/endpointDefinitions.ts
|
|
21
|
+
const ENDPOINT_QUERY = "query";
|
|
22
|
+
const ENDPOINT_MUTATION = "mutation";
|
|
23
|
+
const ENDPOINT_INFINITEQUERY = "infinitequery";
|
|
59
24
|
function isQueryDefinition(e) {
|
|
60
|
-
|
|
25
|
+
return e.type === ENDPOINT_QUERY;
|
|
61
26
|
}
|
|
62
27
|
function isMutationDefinition(e) {
|
|
63
|
-
|
|
28
|
+
return e.type === ENDPOINT_MUTATION;
|
|
64
29
|
}
|
|
65
30
|
function isInfiniteQueryDefinition(e) {
|
|
66
|
-
|
|
31
|
+
return e.type === ENDPOINT_INFINITEQUERY;
|
|
67
32
|
}
|
|
68
|
-
|
|
69
|
-
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/query/tsHelpers.ts
|
|
70
35
|
function safeAssign(target, ...args) {
|
|
71
|
-
|
|
36
|
+
return Object.assign(target, ...args);
|
|
72
37
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var UNINITIALIZED_VALUE = /* @__PURE__ */ Symbol();
|
|
79
|
-
|
|
80
|
-
// src/query/react/reactImports.ts
|
|
81
|
-
import { useEffect, useRef, useMemo, useContext, useCallback, useDebugValue, useLayoutEffect, useState } from "react";
|
|
82
|
-
|
|
83
|
-
// src/query/react/reactReduxImports.ts
|
|
84
|
-
import { shallowEqual, Provider, ReactReduxContext } from "react-redux";
|
|
85
|
-
|
|
86
|
-
// src/query/react/useSerializedStableValue.ts
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/query/react/constants.ts
|
|
40
|
+
const UNINITIALIZED_VALUE = Symbol();
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/query/react/useSerializedStableValue.ts
|
|
87
43
|
function useStableQueryArgs(queryArgs) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}, [copy]);
|
|
95
|
-
return copy;
|
|
44
|
+
const cache = useRef(queryArgs);
|
|
45
|
+
const copy = useMemo(() => copyWithStructuralSharing(cache.current, queryArgs), [queryArgs]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (cache.current !== copy) cache.current = copy;
|
|
48
|
+
}, [copy]);
|
|
49
|
+
return copy;
|
|
96
50
|
}
|
|
97
|
-
|
|
98
|
-
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/query/react/useShallowStableValue.ts
|
|
99
53
|
function useShallowStableValue(value) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}, [value]);
|
|
106
|
-
return shallowEqual(cache.current, value) ? cache.current : value;
|
|
54
|
+
const cache = useRef(value);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!shallowEqual(cache.current, value)) cache.current = value;
|
|
57
|
+
}, [value]);
|
|
58
|
+
return shallowEqual(cache.current, value) ? cache.current : value;
|
|
107
59
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/typeof.js
|
|
62
|
+
function _typeof(o) {
|
|
63
|
+
"@babel/helpers - typeof";
|
|
64
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
65
|
+
return typeof o;
|
|
66
|
+
} : function(o) {
|
|
67
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
68
|
+
}, _typeof(o);
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPrimitive.js
|
|
72
|
+
function toPrimitive(t, r) {
|
|
73
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
74
|
+
var e = t[Symbol.toPrimitive];
|
|
75
|
+
if (void 0 !== e) {
|
|
76
|
+
var i = e.call(t, r || "default");
|
|
77
|
+
if ("object" != _typeof(i)) return i;
|
|
78
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
79
|
+
}
|
|
80
|
+
return ("string" === r ? String : Number)(t);
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPropertyKey.js
|
|
84
|
+
function toPropertyKey(t) {
|
|
85
|
+
var i = toPrimitive(t, "string");
|
|
86
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/defineProperty.js
|
|
90
|
+
function _defineProperty(e, r, t) {
|
|
91
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
92
|
+
value: t,
|
|
93
|
+
enumerable: !0,
|
|
94
|
+
configurable: !0,
|
|
95
|
+
writable: !0
|
|
96
|
+
}) : e[r] = t, e;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/objectSpread2.js
|
|
100
|
+
function ownKeys(e, r) {
|
|
101
|
+
var t = Object.keys(e);
|
|
102
|
+
if (Object.getOwnPropertySymbols) {
|
|
103
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
104
|
+
r && (o = o.filter(function(r) {
|
|
105
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
106
|
+
})), t.push.apply(t, o);
|
|
107
|
+
}
|
|
108
|
+
return t;
|
|
109
|
+
}
|
|
110
|
+
function _objectSpread2(e) {
|
|
111
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
112
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
113
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
114
|
+
_defineProperty(e, r, t[r]);
|
|
115
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
116
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return e;
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
123
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
124
|
+
if (null == r) return {};
|
|
125
|
+
var t = {};
|
|
126
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
127
|
+
if (e.includes(n)) continue;
|
|
128
|
+
t[n] = r[n];
|
|
129
|
+
}
|
|
130
|
+
return t;
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/objectWithoutProperties.js
|
|
134
|
+
function _objectWithoutProperties(e, t) {
|
|
135
|
+
if (null == e) return {};
|
|
136
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
137
|
+
if (Object.getOwnPropertySymbols) {
|
|
138
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
139
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
140
|
+
}
|
|
141
|
+
return i;
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/query/react/buildHooks.ts
|
|
145
|
+
const _excluded$1 = [
|
|
146
|
+
"refetchOnReconnect",
|
|
147
|
+
"refetchOnFocus",
|
|
148
|
+
"refetchOnMountOrArgChange",
|
|
149
|
+
"skip",
|
|
150
|
+
"pollingInterval",
|
|
151
|
+
"skipPollingIfUnfocused"
|
|
152
|
+
];
|
|
153
|
+
const canUseDOM = () => !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
154
|
+
const isDOM = /* @__PURE__ */ canUseDOM();
|
|
155
|
+
const isRunningInReactNative = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
156
|
+
const isReactNative = /* @__PURE__ */ isRunningInReactNative();
|
|
157
|
+
const getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? useLayoutEffect : useEffect;
|
|
158
|
+
const useIsomorphicLayoutEffect = /* @__PURE__ */ getUseIsomorphicLayoutEffect();
|
|
159
|
+
const noPendingQueryStateSelector = (selected) => {
|
|
160
|
+
if (selected.isUninitialized) return _objectSpread2(_objectSpread2({}, selected), {}, {
|
|
161
|
+
isUninitialized: false,
|
|
162
|
+
isFetching: true,
|
|
163
|
+
isLoading: selected.data !== void 0 ? false : true,
|
|
164
|
+
status: QueryStatus.pending
|
|
165
|
+
});
|
|
166
|
+
return selected;
|
|
128
167
|
};
|
|
129
168
|
function pick(obj, ...keys) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
169
|
+
const ret = {};
|
|
170
|
+
keys.forEach((key) => {
|
|
171
|
+
ret[key] = obj[key];
|
|
172
|
+
});
|
|
173
|
+
return ret;
|
|
135
174
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
refetchOnFocus,
|
|
233
|
-
refetchOnMountOrArgChange,
|
|
234
|
-
skip = false,
|
|
235
|
-
pollingInterval = 0,
|
|
236
|
-
skipPollingIfUnfocused = false
|
|
237
|
-
} = _b, rest = __objRest(_b, [
|
|
238
|
-
"refetchOnReconnect",
|
|
239
|
-
"refetchOnFocus",
|
|
240
|
-
"refetchOnMountOrArgChange",
|
|
241
|
-
"skip",
|
|
242
|
-
"pollingInterval",
|
|
243
|
-
"skipPollingIfUnfocused"
|
|
244
|
-
]);
|
|
245
|
-
const {
|
|
246
|
-
initiate
|
|
247
|
-
} = api.endpoints[endpointName];
|
|
248
|
-
const dispatch = useDispatch();
|
|
249
|
-
const subscriptionSelectorsRef = useRef(void 0);
|
|
250
|
-
if (!subscriptionSelectorsRef.current) {
|
|
251
|
-
const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());
|
|
252
|
-
if (process.env.NODE_ENV !== "production") {
|
|
253
|
-
if (typeof returnedValue !== "object" || typeof (returnedValue == null ? void 0 : returnedValue.type) === "string") {
|
|
254
|
-
throw new Error(process.env.NODE_ENV === "production" ? _formatProdErrorMessage(37) : `Warning: Middleware for RTK-Query API at reducerPath "${api.reducerPath}" has not been added to the store.
|
|
175
|
+
const COMMON_HOOK_DEBUG_FIELDS = [
|
|
176
|
+
"data",
|
|
177
|
+
"status",
|
|
178
|
+
"isLoading",
|
|
179
|
+
"isSuccess",
|
|
180
|
+
"isError",
|
|
181
|
+
"error"
|
|
182
|
+
];
|
|
183
|
+
function buildHooks({ api, moduleOptions: { batch, hooks: { useDispatch, useSelector }, unstable__sideEffectsInRender, createSelector }, serializeQueryArgs, context }) {
|
|
184
|
+
const usePossiblyImmediateEffect = unstable__sideEffectsInRender ? (cb) => cb() : useEffect;
|
|
185
|
+
const unsubscribePromiseRef = (ref) => {
|
|
186
|
+
var _ref$current, _ref$current$unsubscr;
|
|
187
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 || (_ref$current$unsubscr = _ref$current.unsubscribe) === null || _ref$current$unsubscr === void 0 || _ref$current$unsubscr.call(_ref$current);
|
|
188
|
+
ref.current = void 0;
|
|
189
|
+
};
|
|
190
|
+
const endpointDefinitions = context.endpointDefinitions;
|
|
191
|
+
return {
|
|
192
|
+
buildQueryHooks,
|
|
193
|
+
buildInfiniteQueryHooks,
|
|
194
|
+
buildMutationHook,
|
|
195
|
+
usePrefetch
|
|
196
|
+
};
|
|
197
|
+
function queryStatePreSelector(currentState, lastResult, queryArgs) {
|
|
198
|
+
if ((lastResult === null || lastResult === void 0 ? void 0 : lastResult.endpointName) && currentState.isUninitialized) {
|
|
199
|
+
const { endpointName } = lastResult;
|
|
200
|
+
const endpointDefinition = endpointDefinitions[endpointName];
|
|
201
|
+
if (queryArgs !== skipToken && serializeQueryArgs({
|
|
202
|
+
queryArgs: lastResult.originalArgs,
|
|
203
|
+
endpointDefinition,
|
|
204
|
+
endpointName
|
|
205
|
+
}) === serializeQueryArgs({
|
|
206
|
+
queryArgs,
|
|
207
|
+
endpointDefinition,
|
|
208
|
+
endpointName
|
|
209
|
+
})) lastResult = void 0;
|
|
210
|
+
}
|
|
211
|
+
let data = currentState.data;
|
|
212
|
+
if (data === void 0) data = lastResult === null || lastResult === void 0 ? void 0 : lastResult.data;
|
|
213
|
+
const hasData = data !== void 0;
|
|
214
|
+
const isFetching = currentState.isLoading;
|
|
215
|
+
const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;
|
|
216
|
+
const isSuccess = currentState.isSuccess || hasData && (isFetching && currentState.error === void 0 || currentState.isUninitialized);
|
|
217
|
+
return _objectSpread2(_objectSpread2({}, currentState), {}, {
|
|
218
|
+
data,
|
|
219
|
+
currentData: currentState.data,
|
|
220
|
+
isFetching,
|
|
221
|
+
isLoading,
|
|
222
|
+
isSuccess
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function infiniteQueryStatePreSelector(currentState, lastResult, queryArgs) {
|
|
226
|
+
if ((lastResult === null || lastResult === void 0 ? void 0 : lastResult.endpointName) && currentState.isUninitialized) {
|
|
227
|
+
const { endpointName } = lastResult;
|
|
228
|
+
const endpointDefinition = endpointDefinitions[endpointName];
|
|
229
|
+
if (queryArgs !== skipToken && serializeQueryArgs({
|
|
230
|
+
queryArgs: lastResult.originalArgs,
|
|
231
|
+
endpointDefinition,
|
|
232
|
+
endpointName
|
|
233
|
+
}) === serializeQueryArgs({
|
|
234
|
+
queryArgs,
|
|
235
|
+
endpointDefinition,
|
|
236
|
+
endpointName
|
|
237
|
+
})) lastResult = void 0;
|
|
238
|
+
}
|
|
239
|
+
let data = currentState.data;
|
|
240
|
+
if (data === void 0) data = lastResult === null || lastResult === void 0 ? void 0 : lastResult.data;
|
|
241
|
+
const hasData = data !== void 0;
|
|
242
|
+
const isFetching = currentState.isLoading;
|
|
243
|
+
const isLoading = (!lastResult || lastResult.isLoading || lastResult.isUninitialized) && !hasData && isFetching;
|
|
244
|
+
const isSuccess = currentState.isSuccess || hasData && (isFetching && currentState.error === void 0 || currentState.isUninitialized);
|
|
245
|
+
return _objectSpread2(_objectSpread2({}, currentState), {}, {
|
|
246
|
+
data,
|
|
247
|
+
currentData: currentState.data,
|
|
248
|
+
isFetching,
|
|
249
|
+
isLoading,
|
|
250
|
+
isSuccess
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function usePrefetch(endpointName, defaultOptions) {
|
|
254
|
+
const dispatch = useDispatch();
|
|
255
|
+
const stableDefaultOptions = useShallowStableValue(defaultOptions);
|
|
256
|
+
return useCallback((arg, options) => dispatch(api.util.prefetch(endpointName, arg, _objectSpread2(_objectSpread2({}, stableDefaultOptions), options))), [
|
|
257
|
+
endpointName,
|
|
258
|
+
dispatch,
|
|
259
|
+
stableDefaultOptions
|
|
260
|
+
]);
|
|
261
|
+
}
|
|
262
|
+
function useQuerySubscriptionCommonImpl(endpointName, arg, _ref = {}) {
|
|
263
|
+
let { refetchOnReconnect, refetchOnFocus, refetchOnMountOrArgChange, skip = false, pollingInterval = 0, skipPollingIfUnfocused = false } = _ref, rest = _objectWithoutProperties(_ref, _excluded$1);
|
|
264
|
+
const { initiate } = api.endpoints[endpointName];
|
|
265
|
+
const dispatch = useDispatch();
|
|
266
|
+
const subscriptionSelectorsRef = useRef(void 0);
|
|
267
|
+
if (!subscriptionSelectorsRef.current) {
|
|
268
|
+
const returnedValue = dispatch(api.internalActions.internal_getRTKQSubscriptions());
|
|
269
|
+
if (process.env.NODE_ENV !== "production") {
|
|
270
|
+
if (typeof returnedValue !== "object" || typeof (returnedValue === null || returnedValue === void 0 ? void 0 : returnedValue.type) === "string") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(37) : `Warning: Middleware for RTK-Query API at reducerPath "${api.reducerPath}" has not been added to the store.
|
|
255
271
|
You must add the middleware for RTK-Query to function correctly!`);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
setPromise(void 0);
|
|
579
|
-
}
|
|
580
|
-
if (fixedCacheKey) {
|
|
581
|
-
dispatch(api.internalActions.removeMutationResult({
|
|
582
|
-
requestId,
|
|
583
|
-
fixedCacheKey
|
|
584
|
-
}));
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
}, [dispatch, fixedCacheKey, promise, requestId]);
|
|
588
|
-
const debugValue = pick(currentState, ...COMMON_HOOK_DEBUG_FIELDS, "endpointName");
|
|
589
|
-
useDebugValue(debugValue);
|
|
590
|
-
const finalState = useMemo(() => __spreadProps(__spreadValues({}, currentState), {
|
|
591
|
-
originalArgs,
|
|
592
|
-
reset
|
|
593
|
-
}), [currentState, originalArgs, reset]);
|
|
594
|
-
return useMemo(() => [triggerMutation, finalState], [triggerMutation, finalState]);
|
|
595
|
-
};
|
|
596
|
-
}
|
|
272
|
+
}
|
|
273
|
+
subscriptionSelectorsRef.current = returnedValue;
|
|
274
|
+
}
|
|
275
|
+
const stableArg = useStableQueryArgs(skip ? skipToken : arg);
|
|
276
|
+
const stableSubscriptionOptions = useShallowStableValue({
|
|
277
|
+
refetchOnReconnect,
|
|
278
|
+
refetchOnFocus,
|
|
279
|
+
pollingInterval,
|
|
280
|
+
skipPollingIfUnfocused
|
|
281
|
+
});
|
|
282
|
+
const initialPageParam = rest.initialPageParam;
|
|
283
|
+
const stableInitialPageParam = useShallowStableValue(initialPageParam);
|
|
284
|
+
const refetchCachedPages = rest.refetchCachedPages;
|
|
285
|
+
const stableRefetchCachedPages = useShallowStableValue(refetchCachedPages);
|
|
286
|
+
const promiseRef = useRef(void 0);
|
|
287
|
+
let { queryCacheKey, requestId } = promiseRef.current || {};
|
|
288
|
+
let currentRenderHasSubscription = false;
|
|
289
|
+
if (queryCacheKey && requestId) currentRenderHasSubscription = subscriptionSelectorsRef.current.isRequestSubscribed(queryCacheKey, requestId);
|
|
290
|
+
const subscriptionRemoved = !currentRenderHasSubscription && promiseRef.current !== void 0;
|
|
291
|
+
usePossiblyImmediateEffect(() => {
|
|
292
|
+
if (subscriptionRemoved) promiseRef.current = void 0;
|
|
293
|
+
}, [subscriptionRemoved]);
|
|
294
|
+
usePossiblyImmediateEffect(() => {
|
|
295
|
+
var _promiseRef$current;
|
|
296
|
+
const lastPromise = promiseRef.current;
|
|
297
|
+
if (typeof process !== "undefined" && process.env.NODE_ENV === "removeMeOnCompilation") console.log(subscriptionRemoved);
|
|
298
|
+
if (stableArg === skipToken) {
|
|
299
|
+
lastPromise === null || lastPromise === void 0 || lastPromise.unsubscribe();
|
|
300
|
+
promiseRef.current = void 0;
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
const lastSubscriptionOptions = (_promiseRef$current = promiseRef.current) === null || _promiseRef$current === void 0 ? void 0 : _promiseRef$current.subscriptionOptions;
|
|
304
|
+
if (!lastPromise || lastPromise.arg !== stableArg) {
|
|
305
|
+
lastPromise === null || lastPromise === void 0 || lastPromise.unsubscribe();
|
|
306
|
+
const promise = dispatch(initiate(stableArg, _objectSpread2({
|
|
307
|
+
subscriptionOptions: stableSubscriptionOptions,
|
|
308
|
+
forceRefetch: refetchOnMountOrArgChange
|
|
309
|
+
}, isInfiniteQueryDefinition(endpointDefinitions[endpointName]) ? {
|
|
310
|
+
initialPageParam: stableInitialPageParam,
|
|
311
|
+
refetchCachedPages: stableRefetchCachedPages
|
|
312
|
+
} : {})));
|
|
313
|
+
promiseRef.current = promise;
|
|
314
|
+
} else if (stableSubscriptionOptions !== lastSubscriptionOptions) lastPromise.updateSubscriptionOptions(stableSubscriptionOptions);
|
|
315
|
+
}, [
|
|
316
|
+
dispatch,
|
|
317
|
+
initiate,
|
|
318
|
+
refetchOnMountOrArgChange,
|
|
319
|
+
stableArg,
|
|
320
|
+
stableSubscriptionOptions,
|
|
321
|
+
subscriptionRemoved,
|
|
322
|
+
stableInitialPageParam,
|
|
323
|
+
stableRefetchCachedPages,
|
|
324
|
+
endpointName
|
|
325
|
+
]);
|
|
326
|
+
return [
|
|
327
|
+
promiseRef,
|
|
328
|
+
dispatch,
|
|
329
|
+
initiate,
|
|
330
|
+
stableSubscriptionOptions
|
|
331
|
+
];
|
|
332
|
+
}
|
|
333
|
+
function buildUseQueryState(endpointName, preSelector) {
|
|
334
|
+
const useQueryState = (arg, { skip = false, selectFromResult } = {}) => {
|
|
335
|
+
const { select } = api.endpoints[endpointName];
|
|
336
|
+
const stableArg = useStableQueryArgs(skip ? skipToken : arg);
|
|
337
|
+
const lastValue = useRef(void 0);
|
|
338
|
+
const latestDefaultResult = useRef(void 0);
|
|
339
|
+
const selectDefaultResult = useMemo(() => createSelector([
|
|
340
|
+
select(stableArg),
|
|
341
|
+
(_, lastResult) => lastResult,
|
|
342
|
+
(_) => stableArg
|
|
343
|
+
], preSelector, { memoizeOptions: { resultEqualityCheck: shallowEqual } }), [select, stableArg]);
|
|
344
|
+
const currentState = useSelector(useMemo(() => {
|
|
345
|
+
const selectResult = selectFromResult ? createSelector([selectDefaultResult], selectFromResult, { devModeChecks: { identityFunctionCheck: "never" } }) : selectDefaultResult;
|
|
346
|
+
return (state) => {
|
|
347
|
+
const lastResult = lastValue.current;
|
|
348
|
+
const result = selectResult(state, lastResult);
|
|
349
|
+
latestDefaultResult.current = selectDefaultResult(state, lastResult);
|
|
350
|
+
return result;
|
|
351
|
+
};
|
|
352
|
+
}, [selectDefaultResult, selectFromResult]), shallowEqual);
|
|
353
|
+
useIsomorphicLayoutEffect(() => {
|
|
354
|
+
lastValue.current = latestDefaultResult.current;
|
|
355
|
+
});
|
|
356
|
+
return currentState;
|
|
357
|
+
};
|
|
358
|
+
return useQueryState;
|
|
359
|
+
}
|
|
360
|
+
function usePromiseRefUnsubscribeOnUnmount(promiseRef) {
|
|
361
|
+
useEffect(() => {
|
|
362
|
+
return () => {
|
|
363
|
+
unsubscribePromiseRef(promiseRef);
|
|
364
|
+
};
|
|
365
|
+
}, [promiseRef]);
|
|
366
|
+
}
|
|
367
|
+
function refetchOrErrorIfUnmounted(promiseRef) {
|
|
368
|
+
if (!promiseRef.current) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(38) : "Cannot refetch a query that has not been started yet.");
|
|
369
|
+
return promiseRef.current.refetch();
|
|
370
|
+
}
|
|
371
|
+
function buildQueryHooks(endpointName) {
|
|
372
|
+
const useQuerySubscription = (arg, options = {}) => {
|
|
373
|
+
const [promiseRef] = useQuerySubscriptionCommonImpl(endpointName, arg, options);
|
|
374
|
+
usePromiseRefUnsubscribeOnUnmount(promiseRef);
|
|
375
|
+
return useMemo(() => ({ refetch: () => refetchOrErrorIfUnmounted(promiseRef) }), [promiseRef]);
|
|
376
|
+
};
|
|
377
|
+
const useLazyQuerySubscription = ({ refetchOnReconnect, refetchOnFocus, pollingInterval = 0, skipPollingIfUnfocused = false } = {}) => {
|
|
378
|
+
const { initiate } = api.endpoints[endpointName];
|
|
379
|
+
const dispatch = useDispatch();
|
|
380
|
+
const [arg, setArg] = useState(UNINITIALIZED_VALUE);
|
|
381
|
+
const promiseRef = useRef(void 0);
|
|
382
|
+
const stableSubscriptionOptions = useShallowStableValue({
|
|
383
|
+
refetchOnReconnect,
|
|
384
|
+
refetchOnFocus,
|
|
385
|
+
pollingInterval,
|
|
386
|
+
skipPollingIfUnfocused
|
|
387
|
+
});
|
|
388
|
+
usePossiblyImmediateEffect(() => {
|
|
389
|
+
var _promiseRef$current2;
|
|
390
|
+
const lastSubscriptionOptions = (_promiseRef$current2 = promiseRef.current) === null || _promiseRef$current2 === void 0 ? void 0 : _promiseRef$current2.subscriptionOptions;
|
|
391
|
+
if (stableSubscriptionOptions !== lastSubscriptionOptions) {
|
|
392
|
+
var _promiseRef$current3;
|
|
393
|
+
(_promiseRef$current3 = promiseRef.current) === null || _promiseRef$current3 === void 0 || _promiseRef$current3.updateSubscriptionOptions(stableSubscriptionOptions);
|
|
394
|
+
}
|
|
395
|
+
}, [stableSubscriptionOptions]);
|
|
396
|
+
const subscriptionOptionsRef = useRef(stableSubscriptionOptions);
|
|
397
|
+
usePossiblyImmediateEffect(() => {
|
|
398
|
+
subscriptionOptionsRef.current = stableSubscriptionOptions;
|
|
399
|
+
}, [stableSubscriptionOptions]);
|
|
400
|
+
const trigger = useCallback(function(arg, preferCacheValue = false) {
|
|
401
|
+
let promise;
|
|
402
|
+
batch(() => {
|
|
403
|
+
unsubscribePromiseRef(promiseRef);
|
|
404
|
+
promiseRef.current = promise = dispatch(initiate(arg, {
|
|
405
|
+
subscriptionOptions: subscriptionOptionsRef.current,
|
|
406
|
+
forceRefetch: !preferCacheValue
|
|
407
|
+
}));
|
|
408
|
+
setArg(arg);
|
|
409
|
+
});
|
|
410
|
+
return promise;
|
|
411
|
+
}, [dispatch, initiate]);
|
|
412
|
+
const reset = useCallback(() => {
|
|
413
|
+
var _promiseRef$current4;
|
|
414
|
+
if ((_promiseRef$current4 = promiseRef.current) === null || _promiseRef$current4 === void 0 ? void 0 : _promiseRef$current4.queryCacheKey) {
|
|
415
|
+
var _promiseRef$current5;
|
|
416
|
+
dispatch(api.internalActions.removeQueryResult({ queryCacheKey: (_promiseRef$current5 = promiseRef.current) === null || _promiseRef$current5 === void 0 ? void 0 : _promiseRef$current5.queryCacheKey }));
|
|
417
|
+
}
|
|
418
|
+
}, [dispatch]);
|
|
419
|
+
useEffect(() => {
|
|
420
|
+
return () => {
|
|
421
|
+
unsubscribePromiseRef(promiseRef);
|
|
422
|
+
};
|
|
423
|
+
}, []);
|
|
424
|
+
useEffect(() => {
|
|
425
|
+
if (arg !== UNINITIALIZED_VALUE && !promiseRef.current) trigger(arg, true);
|
|
426
|
+
}, [arg, trigger]);
|
|
427
|
+
return useMemo(() => [
|
|
428
|
+
trigger,
|
|
429
|
+
arg,
|
|
430
|
+
{ reset }
|
|
431
|
+
], [
|
|
432
|
+
trigger,
|
|
433
|
+
arg,
|
|
434
|
+
reset
|
|
435
|
+
]);
|
|
436
|
+
};
|
|
437
|
+
const useQueryState = buildUseQueryState(endpointName, queryStatePreSelector);
|
|
438
|
+
return {
|
|
439
|
+
useQueryState,
|
|
440
|
+
useQuerySubscription,
|
|
441
|
+
useLazyQuerySubscription,
|
|
442
|
+
useLazyQuery(options) {
|
|
443
|
+
const [trigger, arg, { reset }] = useLazyQuerySubscription(options);
|
|
444
|
+
const queryStateResults = useQueryState(arg, _objectSpread2(_objectSpread2({}, options), {}, { skip: arg === UNINITIALIZED_VALUE }));
|
|
445
|
+
const info = useMemo(() => ({ lastArg: arg }), [arg]);
|
|
446
|
+
return useMemo(() => [
|
|
447
|
+
trigger,
|
|
448
|
+
_objectSpread2(_objectSpread2({}, queryStateResults), {}, { reset }),
|
|
449
|
+
info
|
|
450
|
+
], [
|
|
451
|
+
trigger,
|
|
452
|
+
queryStateResults,
|
|
453
|
+
reset,
|
|
454
|
+
info
|
|
455
|
+
]);
|
|
456
|
+
},
|
|
457
|
+
useQuery(arg, options) {
|
|
458
|
+
const querySubscriptionResults = useQuerySubscription(arg, options);
|
|
459
|
+
const queryStateResults = useQueryState(arg, _objectSpread2({ selectFromResult: arg === skipToken || (options === null || options === void 0 ? void 0 : options.skip) ? void 0 : noPendingQueryStateSelector }, options));
|
|
460
|
+
const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS);
|
|
461
|
+
useDebugValue(debugValue);
|
|
462
|
+
return useMemo(() => _objectSpread2(_objectSpread2({}, queryStateResults), querySubscriptionResults), [queryStateResults, querySubscriptionResults]);
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
function buildInfiniteQueryHooks(endpointName) {
|
|
467
|
+
const useInfiniteQuerySubscription = (arg, options = {}) => {
|
|
468
|
+
const [promiseRef, dispatch, initiate, stableSubscriptionOptions] = useQuerySubscriptionCommonImpl(endpointName, arg, options);
|
|
469
|
+
const subscriptionOptionsRef = useRef(stableSubscriptionOptions);
|
|
470
|
+
usePossiblyImmediateEffect(() => {
|
|
471
|
+
subscriptionOptionsRef.current = stableSubscriptionOptions;
|
|
472
|
+
}, [stableSubscriptionOptions]);
|
|
473
|
+
const hookRefetchCachedPages = options.refetchCachedPages;
|
|
474
|
+
const stableHookRefetchCachedPages = useShallowStableValue(hookRefetchCachedPages);
|
|
475
|
+
const trigger = useCallback(function(arg, direction) {
|
|
476
|
+
let promise;
|
|
477
|
+
batch(() => {
|
|
478
|
+
unsubscribePromiseRef(promiseRef);
|
|
479
|
+
promiseRef.current = promise = dispatch(initiate(arg, {
|
|
480
|
+
subscriptionOptions: subscriptionOptionsRef.current,
|
|
481
|
+
direction
|
|
482
|
+
}));
|
|
483
|
+
});
|
|
484
|
+
return promise;
|
|
485
|
+
}, [
|
|
486
|
+
promiseRef,
|
|
487
|
+
dispatch,
|
|
488
|
+
initiate
|
|
489
|
+
]);
|
|
490
|
+
usePromiseRefUnsubscribeOnUnmount(promiseRef);
|
|
491
|
+
const stableArg = useStableQueryArgs(options.skip ? skipToken : arg);
|
|
492
|
+
const refetch = useCallback((options) => {
|
|
493
|
+
var _options$refetchCache;
|
|
494
|
+
if (!promiseRef.current) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(38) : "Cannot refetch a query that has not been started yet.");
|
|
495
|
+
const mergedOptions = { refetchCachedPages: (_options$refetchCache = options === null || options === void 0 ? void 0 : options.refetchCachedPages) !== null && _options$refetchCache !== void 0 ? _options$refetchCache : stableHookRefetchCachedPages };
|
|
496
|
+
return promiseRef.current.refetch(mergedOptions);
|
|
497
|
+
}, [promiseRef, stableHookRefetchCachedPages]);
|
|
498
|
+
return useMemo(() => {
|
|
499
|
+
const fetchNextPage = () => {
|
|
500
|
+
return trigger(stableArg, "forward");
|
|
501
|
+
};
|
|
502
|
+
const fetchPreviousPage = () => {
|
|
503
|
+
return trigger(stableArg, "backward");
|
|
504
|
+
};
|
|
505
|
+
return {
|
|
506
|
+
trigger,
|
|
507
|
+
refetch,
|
|
508
|
+
fetchNextPage,
|
|
509
|
+
fetchPreviousPage
|
|
510
|
+
};
|
|
511
|
+
}, [
|
|
512
|
+
refetch,
|
|
513
|
+
trigger,
|
|
514
|
+
stableArg
|
|
515
|
+
]);
|
|
516
|
+
};
|
|
517
|
+
const useInfiniteQueryState = buildUseQueryState(endpointName, infiniteQueryStatePreSelector);
|
|
518
|
+
return {
|
|
519
|
+
useInfiniteQueryState,
|
|
520
|
+
useInfiniteQuerySubscription,
|
|
521
|
+
useInfiniteQuery(arg, options) {
|
|
522
|
+
const { refetch, fetchNextPage, fetchPreviousPage } = useInfiniteQuerySubscription(arg, options);
|
|
523
|
+
const queryStateResults = useInfiniteQueryState(arg, _objectSpread2({ selectFromResult: arg === skipToken || (options === null || options === void 0 ? void 0 : options.skip) ? void 0 : noPendingQueryStateSelector }, options));
|
|
524
|
+
const debugValue = pick(queryStateResults, ...COMMON_HOOK_DEBUG_FIELDS, "hasNextPage", "hasPreviousPage");
|
|
525
|
+
useDebugValue(debugValue);
|
|
526
|
+
return useMemo(() => _objectSpread2(_objectSpread2({}, queryStateResults), {}, {
|
|
527
|
+
fetchNextPage,
|
|
528
|
+
fetchPreviousPage,
|
|
529
|
+
refetch
|
|
530
|
+
}), [
|
|
531
|
+
queryStateResults,
|
|
532
|
+
fetchNextPage,
|
|
533
|
+
fetchPreviousPage,
|
|
534
|
+
refetch
|
|
535
|
+
]);
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
function buildMutationHook(name) {
|
|
540
|
+
return ({ selectFromResult, fixedCacheKey } = {}) => {
|
|
541
|
+
const { select, initiate } = api.endpoints[name];
|
|
542
|
+
const dispatch = useDispatch();
|
|
543
|
+
const [promise, setPromise] = useState();
|
|
544
|
+
useEffect(() => () => {
|
|
545
|
+
if (!(promise === null || promise === void 0 ? void 0 : promise.arg.fixedCacheKey)) promise === null || promise === void 0 || promise.reset();
|
|
546
|
+
}, [promise]);
|
|
547
|
+
const triggerMutation = useCallback(function(arg) {
|
|
548
|
+
const promise = dispatch(initiate(arg, { fixedCacheKey }));
|
|
549
|
+
setPromise(promise);
|
|
550
|
+
return promise;
|
|
551
|
+
}, [
|
|
552
|
+
dispatch,
|
|
553
|
+
initiate,
|
|
554
|
+
fixedCacheKey
|
|
555
|
+
]);
|
|
556
|
+
const { requestId } = promise || {};
|
|
557
|
+
const selectDefaultResult = useMemo(() => select({
|
|
558
|
+
fixedCacheKey,
|
|
559
|
+
requestId: promise === null || promise === void 0 ? void 0 : promise.requestId
|
|
560
|
+
}), [
|
|
561
|
+
fixedCacheKey,
|
|
562
|
+
promise,
|
|
563
|
+
select
|
|
564
|
+
]);
|
|
565
|
+
const currentState = useSelector(useMemo(() => selectFromResult ? createSelector([selectDefaultResult], selectFromResult) : selectDefaultResult, [selectFromResult, selectDefaultResult]), shallowEqual);
|
|
566
|
+
const originalArgs = fixedCacheKey == null ? promise === null || promise === void 0 ? void 0 : promise.arg.originalArgs : void 0;
|
|
567
|
+
const reset = useCallback(() => {
|
|
568
|
+
batch(() => {
|
|
569
|
+
if (promise) setPromise(void 0);
|
|
570
|
+
if (fixedCacheKey) dispatch(api.internalActions.removeMutationResult({
|
|
571
|
+
requestId,
|
|
572
|
+
fixedCacheKey
|
|
573
|
+
}));
|
|
574
|
+
});
|
|
575
|
+
}, [
|
|
576
|
+
dispatch,
|
|
577
|
+
fixedCacheKey,
|
|
578
|
+
promise,
|
|
579
|
+
requestId
|
|
580
|
+
]);
|
|
581
|
+
const debugValue = pick(currentState, ...COMMON_HOOK_DEBUG_FIELDS, "endpointName");
|
|
582
|
+
useDebugValue(debugValue);
|
|
583
|
+
const finalState = useMemo(() => _objectSpread2(_objectSpread2({}, currentState), {}, {
|
|
584
|
+
originalArgs,
|
|
585
|
+
reset
|
|
586
|
+
}), [
|
|
587
|
+
currentState,
|
|
588
|
+
originalArgs,
|
|
589
|
+
reset
|
|
590
|
+
]);
|
|
591
|
+
return useMemo(() => [triggerMutation, finalState], [triggerMutation, finalState]);
|
|
592
|
+
};
|
|
593
|
+
}
|
|
597
594
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
useQuerySubscription
|
|
680
|
-
});
|
|
681
|
-
api[`use${capitalize(endpointName)}Query`] = useQuery;
|
|
682
|
-
api[`useLazy${capitalize(endpointName)}Query`] = useLazyQuery;
|
|
683
|
-
}
|
|
684
|
-
if (isMutationDefinition(definition)) {
|
|
685
|
-
const useMutation = buildMutationHook(endpointName);
|
|
686
|
-
safeAssign(anyApi.endpoints[endpointName], {
|
|
687
|
-
useMutation
|
|
688
|
-
});
|
|
689
|
-
api[`use${capitalize(endpointName)}Mutation`] = useMutation;
|
|
690
|
-
} else if (isInfiniteQueryDefinition(definition)) {
|
|
691
|
-
const {
|
|
692
|
-
useInfiniteQuery,
|
|
693
|
-
useInfiniteQuerySubscription,
|
|
694
|
-
useInfiniteQueryState
|
|
695
|
-
} = buildInfiniteQueryHooks(endpointName);
|
|
696
|
-
safeAssign(anyApi.endpoints[endpointName], {
|
|
697
|
-
useInfiniteQuery,
|
|
698
|
-
useInfiniteQuerySubscription,
|
|
699
|
-
useInfiniteQueryState
|
|
700
|
-
});
|
|
701
|
-
api[`use${capitalize(endpointName)}InfiniteQuery`] = useInfiniteQuery;
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
|
-
}
|
|
706
|
-
};
|
|
595
|
+
//#endregion
|
|
596
|
+
//#region src/query/react/module.ts
|
|
597
|
+
const _excluded = [
|
|
598
|
+
"batch",
|
|
599
|
+
"hooks",
|
|
600
|
+
"createSelector",
|
|
601
|
+
"unstable__sideEffectsInRender"
|
|
602
|
+
];
|
|
603
|
+
const reactHooksModuleName = /* @__PURE__ */ Symbol();
|
|
604
|
+
const reactHooksModule = (_ref = {}) => {
|
|
605
|
+
let { batch: batch$1 = batch, hooks = {
|
|
606
|
+
useDispatch,
|
|
607
|
+
useSelector,
|
|
608
|
+
useStore
|
|
609
|
+
}, createSelector: createSelector$1 = createSelector, unstable__sideEffectsInRender = false } = _ref, rest = _objectWithoutProperties(_ref, _excluded);
|
|
610
|
+
if (process.env.NODE_ENV !== "production") {
|
|
611
|
+
const hookNames = [
|
|
612
|
+
"useDispatch",
|
|
613
|
+
"useSelector",
|
|
614
|
+
"useStore"
|
|
615
|
+
];
|
|
616
|
+
let warned = false;
|
|
617
|
+
for (const hookName of hookNames) {
|
|
618
|
+
if (countObjectKeys(rest) > 0) {
|
|
619
|
+
if (rest[hookName]) {
|
|
620
|
+
if (!warned) {
|
|
621
|
+
console.warn("As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`");
|
|
622
|
+
warned = true;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
hooks[hookName] = rest[hookName];
|
|
626
|
+
}
|
|
627
|
+
if (typeof hooks[hookName] !== "function") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(36) : `When using custom hooks for context, all ${hookNames.length} hooks need to be provided: ${hookNames.join(", ")}.\nHook ${hookName} was either not provided or not a function.`);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return {
|
|
631
|
+
name: reactHooksModuleName,
|
|
632
|
+
init(api, { serializeQueryArgs }, context) {
|
|
633
|
+
const anyApi = api;
|
|
634
|
+
const { buildQueryHooks, buildInfiniteQueryHooks, buildMutationHook, usePrefetch } = buildHooks({
|
|
635
|
+
api,
|
|
636
|
+
moduleOptions: {
|
|
637
|
+
batch: batch$1,
|
|
638
|
+
hooks,
|
|
639
|
+
unstable__sideEffectsInRender,
|
|
640
|
+
createSelector: createSelector$1
|
|
641
|
+
},
|
|
642
|
+
serializeQueryArgs,
|
|
643
|
+
context
|
|
644
|
+
});
|
|
645
|
+
safeAssign(anyApi, { usePrefetch });
|
|
646
|
+
safeAssign(context, { batch: batch$1 });
|
|
647
|
+
return { injectEndpoint(endpointName, definition) {
|
|
648
|
+
if (isQueryDefinition(definition)) {
|
|
649
|
+
const { useQuery, useLazyQuery, useLazyQuerySubscription, useQueryState, useQuerySubscription } = buildQueryHooks(endpointName);
|
|
650
|
+
safeAssign(anyApi.endpoints[endpointName], {
|
|
651
|
+
useQuery,
|
|
652
|
+
useLazyQuery,
|
|
653
|
+
useLazyQuerySubscription,
|
|
654
|
+
useQueryState,
|
|
655
|
+
useQuerySubscription
|
|
656
|
+
});
|
|
657
|
+
api[`use${capitalize(endpointName)}Query`] = useQuery;
|
|
658
|
+
api[`useLazy${capitalize(endpointName)}Query`] = useLazyQuery;
|
|
659
|
+
}
|
|
660
|
+
if (isMutationDefinition(definition)) {
|
|
661
|
+
const useMutation = buildMutationHook(endpointName);
|
|
662
|
+
safeAssign(anyApi.endpoints[endpointName], { useMutation });
|
|
663
|
+
api[`use${capitalize(endpointName)}Mutation`] = useMutation;
|
|
664
|
+
} else if (isInfiniteQueryDefinition(definition)) {
|
|
665
|
+
const { useInfiniteQuery, useInfiniteQuerySubscription, useInfiniteQueryState } = buildInfiniteQueryHooks(endpointName);
|
|
666
|
+
safeAssign(anyApi.endpoints[endpointName], {
|
|
667
|
+
useInfiniteQuery,
|
|
668
|
+
useInfiniteQuerySubscription,
|
|
669
|
+
useInfiniteQueryState
|
|
670
|
+
});
|
|
671
|
+
api[`use${capitalize(endpointName)}InfiniteQuery`] = useInfiniteQuery;
|
|
672
|
+
}
|
|
673
|
+
} };
|
|
674
|
+
}
|
|
675
|
+
};
|
|
707
676
|
};
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
export * from "@reduxjs/toolkit/query";
|
|
711
|
-
|
|
712
|
-
// src/query/react/ApiProvider.tsx
|
|
713
|
-
import { configureStore, formatProdErrorMessage as _formatProdErrorMessage5 } from "@reduxjs/toolkit";
|
|
714
|
-
import * as React from "react";
|
|
677
|
+
//#endregion
|
|
678
|
+
//#region src/query/react/ApiProvider.tsx
|
|
715
679
|
function ApiProvider(props) {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
useEffect(() => props.setupListeners === false ? void 0 : setupListeners(store.dispatch, props.setupListeners), [props.setupListeners, store.dispatch]);
|
|
728
|
-
return /* @__PURE__ */ React.createElement(Provider, { store, context }, props.children);
|
|
680
|
+
const context = props.context || ReactReduxContext;
|
|
681
|
+
if (useContext(context)) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(35) : "Existing Redux context detected. If you already have a store set up, please use the traditional Redux setup.");
|
|
682
|
+
const [store] = React.useState(() => configureStore({
|
|
683
|
+
reducer: { [props.api.reducerPath]: props.api.reducer },
|
|
684
|
+
middleware: (gDM) => gDM().concat(props.api.middleware)
|
|
685
|
+
}));
|
|
686
|
+
useEffect(() => props.setupListeners === false ? void 0 : setupListeners(store.dispatch, props.setupListeners), [props.setupListeners, store.dispatch]);
|
|
687
|
+
return /* @__PURE__ */ React.createElement(Provider, {
|
|
688
|
+
store,
|
|
689
|
+
context
|
|
690
|
+
}, props.children);
|
|
729
691
|
}
|
|
692
|
+
//#endregion
|
|
693
|
+
//#region src/query/react/index.ts
|
|
694
|
+
const createApi = /* @__PURE__ */ buildCreateApi(coreModule(), reactHooksModule());
|
|
695
|
+
//#endregion
|
|
696
|
+
export { ApiProvider, UNINITIALIZED_VALUE, createApi, reactHooksModule, reactHooksModuleName };
|
|
730
697
|
|
|
731
|
-
// src/query/react/index.ts
|
|
732
|
-
var createApi = /* @__PURE__ */ buildCreateApi(coreModule(), reactHooksModule());
|
|
733
|
-
export {
|
|
734
|
-
ApiProvider,
|
|
735
|
-
UNINITIALIZED_VALUE,
|
|
736
|
-
createApi,
|
|
737
|
-
reactHooksModule,
|
|
738
|
-
reactHooksModuleName
|
|
739
|
-
};
|
|
740
698
|
//# sourceMappingURL=rtk-query-react.legacy-esm.js.map
|