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