@depup/reduxjs__toolkit 2.12.0-depup.28

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 (173) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +33 -0
  3. package/changes.json +18 -0
  4. package/dist/cjs/index.js +6 -0
  5. package/dist/cjs/redux-toolkit.development.cjs +2406 -0
  6. package/dist/cjs/redux-toolkit.development.cjs.map +1 -0
  7. package/dist/cjs/redux-toolkit.production.min.cjs +3 -0
  8. package/dist/cjs/redux-toolkit.production.min.cjs.map +1 -0
  9. package/dist/index.d.mts +2665 -0
  10. package/dist/index.d.ts +2665 -0
  11. package/dist/query/cjs/index.js +6 -0
  12. package/dist/query/cjs/rtk-query.development.cjs +3092 -0
  13. package/dist/query/cjs/rtk-query.development.cjs.map +1 -0
  14. package/dist/query/cjs/rtk-query.production.min.cjs +2 -0
  15. package/dist/query/cjs/rtk-query.production.min.cjs.map +1 -0
  16. package/dist/query/index.d.mts +3066 -0
  17. package/dist/query/index.d.ts +3066 -0
  18. package/dist/query/react/cjs/index.js +6 -0
  19. package/dist/query/react/cjs/rtk-query-react.development.cjs +748 -0
  20. package/dist/query/react/cjs/rtk-query-react.development.cjs.map +1 -0
  21. package/dist/query/react/cjs/rtk-query-react.production.min.cjs +2 -0
  22. package/dist/query/react/cjs/rtk-query-react.production.min.cjs.map +1 -0
  23. package/dist/query/react/index.d.mts +1009 -0
  24. package/dist/query/react/index.d.ts +1009 -0
  25. package/dist/query/react/rtk-query-react.browser.mjs +2 -0
  26. package/dist/query/react/rtk-query-react.browser.mjs.map +1 -0
  27. package/dist/query/react/rtk-query-react.legacy-esm.js +740 -0
  28. package/dist/query/react/rtk-query-react.legacy-esm.js.map +1 -0
  29. package/dist/query/react/rtk-query-react.modern.mjs +705 -0
  30. package/dist/query/react/rtk-query-react.modern.mjs.map +1 -0
  31. package/dist/query/rtk-query.browser.mjs +2 -0
  32. package/dist/query/rtk-query.browser.mjs.map +1 -0
  33. package/dist/query/rtk-query.legacy-esm.js +3117 -0
  34. package/dist/query/rtk-query.legacy-esm.js.map +1 -0
  35. package/dist/query/rtk-query.modern.mjs +3052 -0
  36. package/dist/query/rtk-query.modern.mjs.map +1 -0
  37. package/dist/react/cjs/index.js +6 -0
  38. package/dist/react/cjs/redux-toolkit-react.development.cjs +55 -0
  39. package/dist/react/cjs/redux-toolkit-react.development.cjs.map +1 -0
  40. package/dist/react/cjs/redux-toolkit-react.production.min.cjs +2 -0
  41. package/dist/react/cjs/redux-toolkit-react.production.min.cjs.map +1 -0
  42. package/dist/react/index.d.mts +22 -0
  43. package/dist/react/index.d.ts +22 -0
  44. package/dist/react/redux-toolkit-react.browser.mjs +2 -0
  45. package/dist/react/redux-toolkit-react.browser.mjs.map +1 -0
  46. package/dist/react/redux-toolkit-react.legacy-esm.js +47 -0
  47. package/dist/react/redux-toolkit-react.legacy-esm.js.map +1 -0
  48. package/dist/react/redux-toolkit-react.modern.mjs +28 -0
  49. package/dist/react/redux-toolkit-react.modern.mjs.map +1 -0
  50. package/dist/redux-toolkit.browser.mjs +3 -0
  51. package/dist/redux-toolkit.browser.mjs.map +1 -0
  52. package/dist/redux-toolkit.legacy-esm.js +2351 -0
  53. package/dist/redux-toolkit.legacy-esm.js.map +1 -0
  54. package/dist/redux-toolkit.modern.mjs +2330 -0
  55. package/dist/redux-toolkit.modern.mjs.map +1 -0
  56. package/dist/uncheckedindexed.ts +16 -0
  57. package/package.json +310 -0
  58. package/query/package.json +13 -0
  59. package/query/react/package.json +13 -0
  60. package/react/package.json +13 -0
  61. package/skills/build-modern-redux-apps/modern-redux/SKILL.md +304 -0
  62. package/skills/build-modern-redux-apps/modern-redux/references/store-lifetime.md +53 -0
  63. package/skills/build-modern-redux-apps/redux-dataflow/SKILL.md +264 -0
  64. package/skills/evolve-and-diagnose-redux-apps/debug-redux-toolkit-apps/SKILL.md +269 -0
  65. package/skills/evolve-and-diagnose-redux-apps/migrate-to-modern-redux/SKILL.md +226 -0
  66. package/skills/manage-server-data/adopt-rtk-query/SKILL.md +385 -0
  67. package/skills/manage-server-data/adopt-rtk-query/references/endpoint-lifecycle.md +36 -0
  68. package/skills/model-redux-state/build-slices-and-selectors/SKILL.md +364 -0
  69. package/skills/model-redux-state/build-slices-and-selectors/references/slice-patterns.md +59 -0
  70. package/skills/model-redux-state/design-state-ownership/SKILL.md +322 -0
  71. package/skills/model-redux-state/design-state-ownership/references/state-ownership.md +28 -0
  72. package/skills/orchestrate-side-effects/handle-side-effects/SKILL.md +271 -0
  73. package/skills/orchestrate-side-effects/handle-side-effects/references/listener-workflows.md +34 -0
  74. package/src/actionCreatorInvariantMiddleware.ts +34 -0
  75. package/src/autoBatchEnhancer.ts +146 -0
  76. package/src/combineSlices.ts +487 -0
  77. package/src/configureStore.ts +248 -0
  78. package/src/createAction.ts +324 -0
  79. package/src/createAsyncThunk.ts +791 -0
  80. package/src/createDraftSafeSelector.ts +30 -0
  81. package/src/createReducer.ts +217 -0
  82. package/src/createSlice.ts +1079 -0
  83. package/src/devtoolsExtension.ts +241 -0
  84. package/src/dynamicMiddleware/index.ts +93 -0
  85. package/src/dynamicMiddleware/react/index.ts +101 -0
  86. package/src/dynamicMiddleware/types.ts +82 -0
  87. package/src/entities/create_adapter.ts +47 -0
  88. package/src/entities/entity_state.ts +38 -0
  89. package/src/entities/index.ts +8 -0
  90. package/src/entities/models.ts +198 -0
  91. package/src/entities/sorted_state_adapter.ts +266 -0
  92. package/src/entities/state_adapter.ts +58 -0
  93. package/src/entities/state_selectors.ts +73 -0
  94. package/src/entities/unsorted_state_adapter.ts +204 -0
  95. package/src/entities/utils.ts +68 -0
  96. package/src/formatProdErrorMessage.ts +13 -0
  97. package/src/getDefaultEnhancers.ts +31 -0
  98. package/src/getDefaultMiddleware.ts +113 -0
  99. package/src/immerImports.ts +7 -0
  100. package/src/immutableStateInvariantMiddleware.ts +274 -0
  101. package/src/index.ts +213 -0
  102. package/src/listenerMiddleware/exceptions.ts +20 -0
  103. package/src/listenerMiddleware/index.ts +562 -0
  104. package/src/listenerMiddleware/task.ts +100 -0
  105. package/src/listenerMiddleware/types.ts +886 -0
  106. package/src/listenerMiddleware/utils.ts +30 -0
  107. package/src/mapBuilders.ts +298 -0
  108. package/src/matchers.ts +365 -0
  109. package/src/nanoid.ts +20 -0
  110. package/src/query/HandledError.ts +6 -0
  111. package/src/query/apiTypes.ts +120 -0
  112. package/src/query/baseQueryTypes.ts +101 -0
  113. package/src/query/core/apiState.ts +377 -0
  114. package/src/query/core/buildInitiate.ts +596 -0
  115. package/src/query/core/buildMiddleware/batchActions.ts +207 -0
  116. package/src/query/core/buildMiddleware/cacheCollection.ts +204 -0
  117. package/src/query/core/buildMiddleware/cacheLifecycle.ts +379 -0
  118. package/src/query/core/buildMiddleware/devMiddleware.ts +34 -0
  119. package/src/query/core/buildMiddleware/index.ts +162 -0
  120. package/src/query/core/buildMiddleware/invalidationByTags.ts +139 -0
  121. package/src/query/core/buildMiddleware/polling.ts +187 -0
  122. package/src/query/core/buildMiddleware/queryLifecycle.ts +508 -0
  123. package/src/query/core/buildMiddleware/types.ts +173 -0
  124. package/src/query/core/buildMiddleware/windowEventHandling.ts +64 -0
  125. package/src/query/core/buildSelectors.ts +413 -0
  126. package/src/query/core/buildSlice.ts +735 -0
  127. package/src/query/core/buildThunks.ts +1124 -0
  128. package/src/query/core/index.ts +58 -0
  129. package/src/query/core/module.ts +727 -0
  130. package/src/query/core/rtkImports.ts +24 -0
  131. package/src/query/core/setupListeners.ts +118 -0
  132. package/src/query/createApi.ts +506 -0
  133. package/src/query/defaultSerializeQueryArgs.ts +52 -0
  134. package/src/query/endpointDefinitions.ts +1717 -0
  135. package/src/query/fakeBaseQuery.ts +21 -0
  136. package/src/query/fetchBaseQuery.ts +385 -0
  137. package/src/query/index.ts +105 -0
  138. package/src/query/react/ApiProvider.tsx +69 -0
  139. package/src/query/react/buildHooks.ts +2297 -0
  140. package/src/query/react/constants.ts +2 -0
  141. package/src/query/react/index.ts +45 -0
  142. package/src/query/react/module.ts +275 -0
  143. package/src/query/react/namedHooks.ts +59 -0
  144. package/src/query/react/reactImports.ts +10 -0
  145. package/src/query/react/reactReduxImports.ts +1 -0
  146. package/src/query/react/rtkqImports.ts +8 -0
  147. package/src/query/react/useSerializedStableValue.ts +17 -0
  148. package/src/query/react/useShallowStableValue.ts +13 -0
  149. package/src/query/retry.ts +233 -0
  150. package/src/query/standardSchema.ts +35 -0
  151. package/src/query/tsHelpers.ts +48 -0
  152. package/src/query/utils/capitalize.ts +3 -0
  153. package/src/query/utils/copyWithStructuralSharing.ts +27 -0
  154. package/src/query/utils/countObjectKeys.ts +14 -0
  155. package/src/query/utils/filterMap.ts +27 -0
  156. package/src/query/utils/getCurrent.ts +6 -0
  157. package/src/query/utils/getOrInsert.ts +41 -0
  158. package/src/query/utils/immerImports.ts +9 -0
  159. package/src/query/utils/index.ts +11 -0
  160. package/src/query/utils/isAbsoluteUrl.ts +9 -0
  161. package/src/query/utils/isDocumentVisible.ts +12 -0
  162. package/src/query/utils/isNotNullish.ts +7 -0
  163. package/src/query/utils/isOnline.ts +12 -0
  164. package/src/query/utils/isValidUrl.ts +9 -0
  165. package/src/query/utils/joinUrls.ts +26 -0
  166. package/src/query/utils/signals.ts +33 -0
  167. package/src/react/index.ts +7 -0
  168. package/src/reduxImports.ts +8 -0
  169. package/src/reselectImports.ts +1 -0
  170. package/src/serializableStateInvariantMiddleware.ts +285 -0
  171. package/src/tsHelpers.ts +214 -0
  172. package/src/uncheckedindexed.ts +16 -0
  173. package/src/utils.ts +125 -0
@@ -0,0 +1,16 @@
1
+ // inlined from https://github.com/EskiMojo14/uncheckedindexed
2
+ // relies on remaining as a TS file, not .d.ts
3
+ type IfMaybeUndefined<T, True, False> = [undefined] extends [T] ? True : False
4
+
5
+ const testAccess = ({} as Record<string, 0>)['a']
6
+
7
+ export type IfUncheckedIndexedAccess<True, False> = IfMaybeUndefined<
8
+ typeof testAccess,
9
+ True,
10
+ False
11
+ >
12
+
13
+ export type UncheckedIndexedAccess<T> = IfUncheckedIndexedAccess<
14
+ T | undefined,
15
+ T
16
+ >
package/package.json ADDED
@@ -0,0 +1,310 @@
1
+ {
2
+ "name": "@depup/reduxjs__toolkit",
3
+ "version": "2.12.0-depup.28",
4
+ "description": "The official, opinionated, batteries-included toolset for efficient Redux development (with updated dependencies)",
5
+ "author": "Mark Erikson <mark@isquaredsoftware.com>",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/reduxjs/redux-toolkit.git"
10
+ },
11
+ "keywords": [
12
+ "@reduxjs/toolkit",
13
+ "depup",
14
+ "updated-dependencies",
15
+ "security",
16
+ "latest",
17
+ "patched",
18
+ "redux",
19
+ "react",
20
+ "starter",
21
+ "toolkit",
22
+ "reducer",
23
+ "slice",
24
+ "immer",
25
+ "immutable",
26
+ "redux-toolkit",
27
+ "tanstack-intent"
28
+ ],
29
+ "module": "dist/redux-toolkit.legacy-esm.js",
30
+ "main": "dist/cjs/index.js",
31
+ "types": "dist/index.d.ts",
32
+ "react-native": "dist/redux-toolkit.legacy-esm.js",
33
+ "unpkg": "dist/redux-toolkit.browser.mjs",
34
+ "exports": {
35
+ "./package.json": "./package.json",
36
+ ".": {
37
+ "module-sync": {
38
+ "types": "./dist/index.d.mts",
39
+ "default": "./dist/redux-toolkit.modern.mjs"
40
+ },
41
+ "module": {
42
+ "types": "./dist/index.d.mts",
43
+ "default": "./dist/redux-toolkit.modern.mjs"
44
+ },
45
+ "react-native": {
46
+ "import": {
47
+ "types": "./dist/index.d.mts",
48
+ "default": "./dist/redux-toolkit.modern.mjs"
49
+ },
50
+ "default": {
51
+ "types": "./dist/index.d.ts",
52
+ "default": "./dist/cjs/index.js"
53
+ }
54
+ },
55
+ "browser": {
56
+ "import": {
57
+ "types": "./dist/index.d.mts",
58
+ "default": "./dist/redux-toolkit.browser.mjs"
59
+ },
60
+ "default": {
61
+ "types": "./dist/index.d.ts",
62
+ "default": "./dist/cjs/index.js"
63
+ }
64
+ },
65
+ "import": {
66
+ "types": "./dist/index.d.mts",
67
+ "default": "./dist/redux-toolkit.modern.mjs"
68
+ },
69
+ "default": {
70
+ "types": "./dist/index.d.ts",
71
+ "default": "./dist/cjs/index.js"
72
+ }
73
+ },
74
+ "./react": {
75
+ "module-sync": {
76
+ "types": "./dist/react/index.d.mts",
77
+ "default": "./dist/react/redux-toolkit-react.modern.mjs"
78
+ },
79
+ "module": {
80
+ "types": "./dist/react/index.d.mts",
81
+ "default": "./dist/react/redux-toolkit-react.modern.mjs"
82
+ },
83
+ "react-native": {
84
+ "import": {
85
+ "types": "./dist/react/index.d.mts",
86
+ "default": "./dist/react/redux-toolkit-react.modern.mjs"
87
+ },
88
+ "default": {
89
+ "types": "./dist/react/index.d.ts",
90
+ "default": "./dist/react/cjs/index.js"
91
+ }
92
+ },
93
+ "browser": {
94
+ "import": {
95
+ "types": "./dist/react/index.d.mts",
96
+ "default": "./dist/react/redux-toolkit-react.browser.mjs"
97
+ },
98
+ "default": {
99
+ "types": "./dist/react/index.d.ts",
100
+ "default": "./dist/react/cjs/index.js"
101
+ }
102
+ },
103
+ "import": {
104
+ "types": "./dist/react/index.d.mts",
105
+ "default": "./dist/react/redux-toolkit-react.modern.mjs"
106
+ },
107
+ "default": {
108
+ "types": "./dist/react/index.d.ts",
109
+ "default": "./dist/react/cjs/index.js"
110
+ }
111
+ },
112
+ "./query": {
113
+ "module-sync": {
114
+ "types": "./dist/query/index.d.mts",
115
+ "default": "./dist/query/rtk-query.modern.mjs"
116
+ },
117
+ "module": {
118
+ "types": "./dist/query/index.d.mts",
119
+ "default": "./dist/query/rtk-query.modern.mjs"
120
+ },
121
+ "react-native": {
122
+ "import": {
123
+ "types": "./dist/query/index.d.mts",
124
+ "default": "./dist/query/rtk-query.modern.mjs"
125
+ },
126
+ "default": {
127
+ "types": "./dist/query/index.d.ts",
128
+ "default": "./dist/query/cjs/index.js"
129
+ }
130
+ },
131
+ "browser": {
132
+ "import": {
133
+ "types": "./dist/query/index.d.mts",
134
+ "default": "./dist/query/rtk-query.browser.mjs"
135
+ },
136
+ "default": {
137
+ "types": "./dist/query/index.d.ts",
138
+ "default": "./dist/query/cjs/index.js"
139
+ }
140
+ },
141
+ "import": {
142
+ "types": "./dist/query/index.d.mts",
143
+ "default": "./dist/query/rtk-query.modern.mjs"
144
+ },
145
+ "default": {
146
+ "types": "./dist/query/index.d.ts",
147
+ "default": "./dist/query/cjs/index.js"
148
+ }
149
+ },
150
+ "./query/react": {
151
+ "module-sync": {
152
+ "types": "./dist/query/react/index.d.mts",
153
+ "default": "./dist/query/react/rtk-query-react.modern.mjs"
154
+ },
155
+ "module": {
156
+ "types": "./dist/query/react/index.d.mts",
157
+ "default": "./dist/query/react/rtk-query-react.modern.mjs"
158
+ },
159
+ "react-native": {
160
+ "import": {
161
+ "types": "./dist/query/react/index.d.mts",
162
+ "default": "./dist/query/react/rtk-query-react.modern.mjs"
163
+ },
164
+ "default": {
165
+ "types": "./dist/query/react/index.d.ts",
166
+ "default": "./dist/query/react/cjs/index.js"
167
+ }
168
+ },
169
+ "browser": {
170
+ "import": {
171
+ "types": "./dist/query/react/index.d.mts",
172
+ "default": "./dist/query/react/rtk-query-react.browser.mjs"
173
+ },
174
+ "default": {
175
+ "types": "./dist/query/react/index.d.ts",
176
+ "default": "./dist/query/react/cjs/index.js"
177
+ }
178
+ },
179
+ "import": {
180
+ "types": "./dist/query/react/index.d.mts",
181
+ "default": "./dist/query/react/rtk-query-react.modern.mjs"
182
+ },
183
+ "default": {
184
+ "types": "./dist/query/react/index.d.ts",
185
+ "default": "./dist/query/react/cjs/index.js"
186
+ }
187
+ }
188
+ },
189
+ "devDependencies": {
190
+ "@arethetypeswrong/cli": "^0.18.2",
191
+ "@babel/core": "^7.24.8",
192
+ "@babel/helper-module-imports": "^7.24.7",
193
+ "@microsoft/api-extractor": "^7.13.2",
194
+ "@phryneas/ts-version": "^1.0.2",
195
+ "@size-limit/file": "^11.0.1",
196
+ "@size-limit/webpack": "^11.0.1",
197
+ "@tanstack/intent": "^0.0.19",
198
+ "@testing-library/dom": "^10.4.0",
199
+ "@testing-library/react": "^16.0.1",
200
+ "@testing-library/react-render-stream": "^1.0.3",
201
+ "@testing-library/user-event": "^14.5.2",
202
+ "@types/babel__core": "^7.20.5",
203
+ "@types/babel__helper-module-imports": "^7.18.3",
204
+ "@types/node": "^25.5.0",
205
+ "@types/query-string": "^6.3.0",
206
+ "@types/react": "^19.0.1",
207
+ "@types/react-dom": "^19.0.1",
208
+ "@typescript-eslint/eslint-plugin": "^6",
209
+ "@typescript-eslint/parser": "^6",
210
+ "axios": "^0.19.2",
211
+ "esbuild": "^0.25.1",
212
+ "esbuild-extra": "^0.4.0",
213
+ "eslint": "^7.25.0",
214
+ "eslint-config-prettier": "^9.1.0",
215
+ "eslint-config-react-app": "^7.0.1",
216
+ "eslint-plugin-flowtype": "^5.7.2",
217
+ "eslint-plugin-import": "^2.22.1",
218
+ "eslint-plugin-jsx-a11y": "^6.4.1",
219
+ "eslint-plugin-prettier": "^5.1.3",
220
+ "eslint-plugin-react": "^7.23.2",
221
+ "eslint-plugin-react-hooks": "^4.2.0",
222
+ "jsdom": "^25.0.1",
223
+ "msw": "^2.1.4",
224
+ "node-fetch": "^3.3.2",
225
+ "prettier": "^3.2.5",
226
+ "query-string": "^7.0.1",
227
+ "react": "^19.0.0",
228
+ "react-dom": "^19.0.0",
229
+ "react-redux": "^9.2.0",
230
+ "rimraf": "^6.1.3",
231
+ "size-limit": "^11.0.1",
232
+ "tsup": "^8.4.0",
233
+ "tsx": "^4.19.0",
234
+ "typescript": "^5.9.3",
235
+ "valibot": "^1.0.0",
236
+ "vite-tsconfig-paths": "^4.3.1",
237
+ "vitest": "^4"
238
+ },
239
+ "scripts": {
240
+ "clean": "rimraf dist",
241
+ "run-build": "tsup --config=$INIT_CWD/tsup.config.mts",
242
+ "build": "yarn clean && yarn run-build && tsx scripts/fixUniqueSymbolExports.mts",
243
+ "build-only": "yarn clean && yarn run-build",
244
+ "format": "prettier --write \"(src|examples)/**/*.{ts,tsx}\" \"**/*.md\"",
245
+ "format:check": "prettier --list-different \"(src|examples)/**/*.{ts,tsx}\" \"docs/*/**.md\"",
246
+ "lint": "eslint src examples",
247
+ "test": "vitest --typecheck --run ",
248
+ "test:watch": "vitest --watch",
249
+ "type-tests": "yarn tsc -p tsconfig.test.json --noEmit",
250
+ "size": "size-limit"
251
+ },
252
+ "files": [
253
+ "dist/",
254
+ "src/",
255
+ "!src/**/tests/**",
256
+ "!src/**/*.{test,spec}(-d)?.(c|m)[tj]sx?",
257
+ "query",
258
+ "react",
259
+ "skills",
260
+ "!skills/_artifacts",
261
+ "changes.json",
262
+ "README.md"
263
+ ],
264
+ "dependencies": {
265
+ "@standard-schema/spec": "^1.1.0",
266
+ "@standard-schema/utils": "^0.3.0",
267
+ "immer": "^11.1.15",
268
+ "redux": "^5.0.1",
269
+ "redux-thunk": "^3.1.0",
270
+ "reselect": "^5.2.0"
271
+ },
272
+ "peerDependencies": {
273
+ "react": "^16.9.0 || ^17.0.0 || ^18 || ^19",
274
+ "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0"
275
+ },
276
+ "peerDependenciesMeta": {
277
+ "react": {
278
+ "optional": true
279
+ },
280
+ "react-redux": {
281
+ "optional": true
282
+ }
283
+ },
284
+ "sideEffects": false,
285
+ "bugs": {
286
+ "url": "https://github.com/reduxjs/redux-toolkit/issues"
287
+ },
288
+ "homepage": "https://redux-toolkit.js.org",
289
+ "depup": {
290
+ "changes": {
291
+ "@standard-schema/spec": {
292
+ "from": "^1.0.0",
293
+ "to": "^1.1.0"
294
+ },
295
+ "immer": {
296
+ "from": "^11.0.0",
297
+ "to": "^11.1.15"
298
+ },
299
+ "reselect": {
300
+ "from": "^5.1.0",
301
+ "to": "^5.2.0"
302
+ }
303
+ },
304
+ "depsUpdated": 3,
305
+ "originalPackage": "@reduxjs/toolkit",
306
+ "originalVersion": "2.12.0",
307
+ "processedAt": "2026-07-21T17:20:38.831Z",
308
+ "smokeTest": "passed"
309
+ }
310
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@reduxjs/toolkit-query",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "type": "module",
6
+ "module": "../dist/query/rtk-query.legacy-esm.js",
7
+ "main": "../dist/query/cjs/index.js",
8
+ "types": "./../dist/query/index.d.ts",
9
+ "react-native": "./../dist/query/rtk-query.legacy-esm.js",
10
+ "author": "Mark Erikson <mark@isquaredsoftware.com>",
11
+ "license": "MIT",
12
+ "sideEffects": false
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@reduxjs/toolkit-query-react",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "type": "module",
6
+ "module": "../../dist/query/react/rtk-query-react.legacy-esm.js",
7
+ "main": "../../dist/query/react/cjs/index.js",
8
+ "types": "./../../dist/query/react/index.d.ts",
9
+ "react-native": "./../../dist/query/react/rtk-query-react.legacy-esm.js",
10
+ "author": "Mark Erikson <mark@isquaredsoftware.com>",
11
+ "license": "MIT",
12
+ "sideEffects": false
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@reduxjs/toolkit-react",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "type": "module",
6
+ "module": "../dist/react/redux-toolkit-react.legacy-esm.js",
7
+ "main": "./../dist/react/redux-toolkit-react.modern.mjs",
8
+ "types": "./../dist/react/index.d.ts",
9
+ "react-native": "./../dist/react/redux-toolkit-react.modern.mjs",
10
+ "author": "Mark Erikson <mark@isquaredsoftware.com>",
11
+ "license": "MIT",
12
+ "sideEffects": false
13
+ }
@@ -0,0 +1,304 @@
1
+ ---
2
+ name: build-modern-redux-apps/modern-redux
3
+ description: >
4
+ Use this when setting up a new Redux Toolkit app or modernizing an existing
5
+ React + Redux codebase. Covers configureStore, Provider wiring, typed hooks,
6
+ hooks-first React-Redux usage, feature folders, and the correct store lifetime
7
+ for SPA and SSR-heavy React environments.
8
+ type: lifecycle
9
+ library: "@reduxjs/toolkit"
10
+ library_version: "2.11.2"
11
+ requires:
12
+ - build-modern-redux-apps/redux-dataflow
13
+ sources:
14
+ - "reduxjs/redux-toolkit:docs/tutorials/quick-start.mdx"
15
+ - "reduxjs/redux-toolkit:docs/tutorials/typescript.md"
16
+ - "reduxjs/redux-toolkit:docs/usage/migrating-to-modern-redux.mdx"
17
+ - "reduxjs/redux-toolkit:docs/usage/nextjs.mdx"
18
+ - "reduxjs/redux:docs/style-guide/style-guide.md"
19
+ ---
20
+
21
+ # Modern Redux
22
+
23
+ ## Setup
24
+
25
+ ```tsx
26
+ // file: src/features/counter/counterSlice.ts
27
+ import { createSlice } from '@reduxjs/toolkit'
28
+
29
+ export const counterSlice = createSlice({
30
+ name: 'counter',
31
+ initialState: { value: 0 },
32
+ reducers: {
33
+ increment(state) {
34
+ state.value += 1
35
+ },
36
+ },
37
+ })
38
+
39
+ export const { increment } = counterSlice.actions
40
+
41
+ // file: src/app/store.ts
42
+ import { configureStore } from '@reduxjs/toolkit'
43
+ import { counterSlice } from '../features/counter/counterSlice'
44
+
45
+ export const store = configureStore({
46
+ reducer: {
47
+ counter: counterSlice.reducer,
48
+ },
49
+ })
50
+
51
+ export type RootState = ReturnType<typeof store.getState>
52
+ export type AppDispatch = typeof store.dispatch
53
+
54
+ // file: src/app/hooks.ts
55
+ import { useDispatch, useSelector } from 'react-redux'
56
+ import type { AppDispatch, RootState } from './store'
57
+
58
+ export const useAppDispatch = useDispatch.withTypes<AppDispatch>()
59
+ export const useAppSelector = useSelector.withTypes<RootState>()
60
+
61
+ // file: src/features/counter/Counter.tsx
62
+ import { increment } from './counterSlice'
63
+ import { useAppDispatch, useAppSelector } from '../../app/hooks'
64
+
65
+ export function Counter() {
66
+ const value = useAppSelector((state) => state.counter.value)
67
+ const dispatch = useAppDispatch()
68
+
69
+ return <button onClick={() => dispatch(increment())}>{value}</button>
70
+ }
71
+
72
+ // file: src/main.tsx
73
+ import React from 'react'
74
+ import ReactDOM from 'react-dom/client'
75
+ import { Provider } from 'react-redux'
76
+ import { store } from './app/store'
77
+ import { Counter } from './features/counter/Counter'
78
+
79
+ ReactDOM.createRoot(document.getElementById('root')!).render(
80
+ <Provider store={store}>
81
+ <Counter />
82
+ </Provider>,
83
+ )
84
+ ```
85
+
86
+ ## Core Patterns
87
+
88
+ ### Keep React components on hooks, not wrappers
89
+
90
+ ```tsx
91
+ import { postAdded, selectPosts } from './postsSlice'
92
+ import { useAppDispatch, useAppSelector } from '../../app/hooks'
93
+
94
+ export function PostsList() {
95
+ const posts = useAppSelector(selectPosts)
96
+ const dispatch = useAppDispatch()
97
+
98
+ return (
99
+ <button
100
+ onClick={() =>
101
+ dispatch(postAdded({ id: 'p2', title: 'Write docs' }))
102
+ }
103
+ >
104
+ {posts.length}
105
+ </button>
106
+ )
107
+ }
108
+ ```
109
+
110
+ Hooks are the default React-Redux integration for new code.
111
+
112
+ ### Create the store inside the provider for SSR-heavy React apps
113
+
114
+ ```tsx
115
+ // file: src/lib/store.ts
116
+ import { configureStore } from '@reduxjs/toolkit'
117
+ import { counterSlice } from '../features/counter/counterSlice'
118
+
119
+ export const makeStore = () =>
120
+ configureStore({
121
+ reducer: {
122
+ counter: counterSlice.reducer,
123
+ },
124
+ })
125
+
126
+ export type AppStore = ReturnType<typeof makeStore>
127
+ export type RootState = ReturnType<AppStore['getState']>
128
+ export type AppDispatch = AppStore['dispatch']
129
+
130
+ // file: src/app/StoreProvider.tsx
131
+ 'use client'
132
+
133
+ import { useState, type ReactNode } from 'react'
134
+ import { Provider } from 'react-redux'
135
+ import { makeStore } from '../lib/store'
136
+
137
+ export function StoreProvider({ children }: { children: ReactNode }) {
138
+ const [store] = useState(makeStore)
139
+
140
+ return <Provider store={store}>{children}</Provider>
141
+ }
142
+ ```
143
+
144
+ In SSR-heavy React frameworks, create a store per request and keep that instance stable across renders.
145
+
146
+ ### Keep app wiring in `app/` and feature logic in feature folders
147
+
148
+ ```text
149
+ src/
150
+ app/
151
+ store.ts
152
+ hooks.ts
153
+ features/
154
+ posts/
155
+ postsSlice.ts
156
+ PostsList.tsx
157
+ users/
158
+ usersSlice.ts
159
+ UsersList.tsx
160
+ ```
161
+
162
+ This keeps store wiring centralized and feature logic colocated.
163
+
164
+ ## Common Mistakes
165
+
166
+ ### HIGH Importing the store in React components
167
+
168
+ Wrong:
169
+
170
+ ```tsx
171
+ import { store } from '../../app/store'
172
+
173
+ export function PostsList() {
174
+ const posts = store.getState().posts
175
+ return <div>{posts.length}</div>
176
+ }
177
+ ```
178
+
179
+ Correct:
180
+
181
+ ```tsx
182
+ import { useAppSelector } from '../../app/hooks'
183
+
184
+ export function PostsList() {
185
+ const posts = useAppSelector((state) => state.posts)
186
+ return <div>{posts.length}</div>
187
+ }
188
+ ```
189
+
190
+ React components should read through context and hooks; direct store imports are a separate escape hatch for non-React integrations, not the default UI pattern.
191
+
192
+ Source: reduxjs/redux:docs/style-guide/style-guide.md
193
+
194
+ ### HIGH Defaulting to `connect()` in new React code
195
+
196
+ Wrong:
197
+
198
+ ```tsx
199
+ import { connect } from 'react-redux'
200
+
201
+ const increment = () => ({ type: 'counter/increment' as const })
202
+ const mapState = (state: { counter: { value: number } }) => ({
203
+ value: state.counter.value,
204
+ })
205
+ const mapDispatch = { increment }
206
+
207
+ function Counter({ value, increment }: ReturnType<typeof mapState> & typeof mapDispatch) {
208
+ return <button onClick={() => increment()}>{value}</button>
209
+ }
210
+
211
+ export default connect(mapState, mapDispatch)(Counter)
212
+ ```
213
+
214
+ Correct:
215
+
216
+ ```tsx
217
+ import { increment } from './counterSlice'
218
+ import { useAppDispatch, useAppSelector } from '../../app/hooks'
219
+
220
+ export function Counter() {
221
+ const value = useAppSelector((state) => state.counter.value)
222
+ const dispatch = useAppDispatch()
223
+
224
+ return <button onClick={() => dispatch(increment())}>{value}</button>
225
+ }
226
+ ```
227
+
228
+ Hooks are the modern default, simpler to type, and the maintainers explicitly want agents to steer new code away from `connect`.
229
+
230
+ Source: reduxjs/redux-toolkit:docs/usage/migrating-to-modern-redux.mdx
231
+
232
+ ### HIGH Recreating the store during render in SSR-heavy apps
233
+
234
+ Wrong:
235
+
236
+ ```tsx
237
+ 'use client'
238
+
239
+ import { Provider } from 'react-redux'
240
+ import { makeStore } from '../lib/store'
241
+
242
+ export function StoreProvider({ children }: { children: import('react').ReactNode }) {
243
+ const store = makeStore()
244
+ return <Provider store={store}>{children}</Provider>
245
+ }
246
+ ```
247
+
248
+ Correct:
249
+
250
+ ```tsx
251
+ 'use client'
252
+
253
+ import { useState } from 'react'
254
+ import { Provider } from 'react-redux'
255
+ import { makeStore } from '../lib/store'
256
+
257
+ export function StoreProvider({ children }: { children: import('react').ReactNode }) {
258
+ const [store] = useState(makeStore)
259
+ return <Provider store={store}>{children}</Provider>
260
+ }
261
+ ```
262
+
263
+ A new store on every render loses client state, while a module singleton can leak across requests on the server.
264
+
265
+ Source: reduxjs/redux-toolkit:docs/usage/nextjs.mdx
266
+
267
+ ### HIGH Keeping `createStore` boilerplate as the default
268
+
269
+ Wrong:
270
+
271
+ ```ts
272
+ import { applyMiddleware, combineReducers, createStore } from 'redux'
273
+ import thunk from 'redux-thunk'
274
+
275
+ const counterReducer = (state = { value: 0 }) => state
276
+
277
+ const rootReducer = combineReducers({
278
+ counter: counterReducer,
279
+ })
280
+
281
+ export const store = createStore(rootReducer, applyMiddleware(thunk))
282
+ ```
283
+
284
+ Correct:
285
+
286
+ ```ts
287
+ import { configureStore } from '@reduxjs/toolkit'
288
+
289
+ const counterReducer = (state = { value: 0 }) => state
290
+
291
+ export const store = configureStore({
292
+ reducer: {
293
+ counter: counterReducer,
294
+ },
295
+ })
296
+ ```
297
+
298
+ Manual store setup works, but it throws away RTK's default middleware, dev checks, and the current recommended baseline.
299
+
300
+ Source: reduxjs/redux-toolkit:docs/usage/migrating-to-modern-redux.mdx
301
+
302
+ ## References
303
+
304
+ - [Store lifetime and framework boundaries](references/store-lifetime.md)