Skip to content

Commit ad6a8e5

Browse files
committed
Merge branch 'master' into create-slice-creators
2 parents e310604 + e31224f commit ad6a8e5

File tree

19 files changed

+18780
-18741
lines changed

19 files changed

+18780
-18741
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
id-token: write
2222
contents: read
2323
steps:
24-
- uses: actions/checkout@v3
25-
- uses: actions/setup-node@v3
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-node@v4
2626
with:
2727
node-version: '20.x'
2828
registry-url: 'https://registry.npmjs.org'

.github/workflows/size.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
env:
1212
CI_JOB_NUMBER: 1
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
- uses: EskiMojo14/size-limit-action@v2
1616
with:
1717
directory: packages/toolkit

.github/workflows/test-codegen.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
outputs:
1616
codegen: ${{ steps.filter.outputs.codegen }}
1717
steps:
18-
- uses: actions/checkout@v2
19-
- uses: dorny/paths-filter@v2
18+
- uses: actions/checkout@v4
19+
- uses: dorny/paths-filter@v3
2020
id: filter
2121
with:
2222
filters: |
@@ -34,9 +34,9 @@ jobs:
3434
node-version: ['20.x']
3535

3636
steps:
37-
- uses: actions/checkout@v2
37+
- uses: actions/checkout@v4
3838
- name: Use Node.js ${{ matrix.node-version }}
39-
uses: actions/setup-node@v2
39+
uses: actions/setup-node@v4
4040
with:
4141
node-version: ${{ matrix.node }}
4242
cache: 'yarn'

.github/workflows/tests.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
outputs:
1212
toolkit: ${{ steps.filter.outputs.toolkit }}
1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: dorny/paths-filter@v2
14+
- uses: actions/checkout@v4
15+
- uses: dorny/paths-filter@v3
1616
id: filter
1717
with:
1818
filters: |
@@ -34,10 +34,10 @@ jobs:
3434

3535
steps:
3636
- name: Checkout repo
37-
uses: actions/checkout@v2
37+
uses: actions/checkout@v4
3838

3939
- name: Use node ${{ matrix.node }}
40-
uses: actions/setup-node@v2
40+
uses: actions/setup-node@v4
4141
with:
4242
node-version: ${{ matrix.node }}
4343
cache: 'yarn'
@@ -55,7 +55,7 @@ jobs:
5555
- name: Pack
5656
run: yarn pack
5757

58-
- uses: actions/upload-artifact@v2
58+
- uses: actions/upload-artifact@v4
5959
with:
6060
name: package
6161
path: packages/toolkit/package.tgz
@@ -70,18 +70,18 @@ jobs:
7070
node: ['20.x']
7171
steps:
7272
- name: Checkout repo
73-
uses: actions/checkout@v2
73+
uses: actions/checkout@v4
7474

7575
- name: Use node ${{ matrix.node }}
76-
uses: actions/setup-node@v2
76+
uses: actions/setup-node@v4
7777
with:
7878
node-version: ${{ matrix.node }}
7979
cache: 'yarn'
8080

8181
- name: Install deps
8282
run: yarn install
8383

84-
- uses: actions/download-artifact@v2
84+
- uses: actions/download-artifact@v4
8585
with:
8686
name: package
8787
path: packages/toolkit
@@ -108,10 +108,10 @@ jobs:
108108
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3']
109109
steps:
110110
- name: Checkout repo
111-
uses: actions/checkout@v2
111+
uses: actions/checkout@v4
112112

113113
- name: Use node ${{ matrix.node }}
114-
uses: actions/setup-node@v2
114+
uses: actions/setup-node@v4
115115
with:
116116
node-version: ${{ matrix.node }}
117117
cache: 'yarn'
@@ -122,7 +122,7 @@ jobs:
122122
- name: Install TypeScript ${{ matrix.ts }}
123123
run: yarn add typescript@${{ matrix.ts }}
124124

125-
- uses: actions/download-artifact@v2
125+
- uses: actions/download-artifact@v4
126126
with:
127127
name: package
128128
path: packages/toolkit
@@ -164,13 +164,13 @@ jobs:
164164
run:
165165
working-directory: ./examples/publish-ci/${{ matrix.example }}
166166
env:
167-
YARN_ENABLE_IMMUTABLE_INSTALLS: "false"
167+
YARN_ENABLE_IMMUTABLE_INSTALLS: false
168168
steps:
169169
- name: Checkout repo
170-
uses: actions/checkout@v2
170+
uses: actions/checkout@v4
171171

172172
- name: Use node ${{ matrix.node }}
173-
uses: actions/setup-node@v2
173+
uses: actions/setup-node@v4
174174
with:
175175
node-version: ${{ matrix.node }}
176176
cache: 'yarn'
@@ -181,7 +181,7 @@ jobs:
181181
- name: Remove existing RTK
182182
run: yarn remove @reduxjs/toolkit
183183

184-
- uses: actions/download-artifact@v2
184+
- uses: actions/download-artifact@v4
185185
with:
186186
name: package
187187
path: ./examples/publish-ci/${{ matrix.example }}
@@ -197,13 +197,15 @@ jobs:
197197

198198
- name: Set up JDK 17 for React Native build
199199
if: matrix.example == 'react-native' || matrix.example == 'expo'
200-
uses: actions/setup-java@v2
200+
uses: actions/setup-java@v4
201201
with:
202202
java-version: '17.x'
203203
distribution: 'temurin'
204204

205205
- name: Build example
206-
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
206+
env:
207+
NODE_OPTIONS: --openssl-legacy-provider
208+
run: yarn build
207209

208210
- name: Run test step
209211
run: yarn test
@@ -219,18 +221,18 @@ jobs:
219221
node: ['20.x']
220222
steps:
221223
- name: Checkout repo
222-
uses: actions/checkout@v2
224+
uses: actions/checkout@v4
223225

224226
- name: Use node ${{ matrix.node }}
225-
uses: actions/setup-node@v2
227+
uses: actions/setup-node@v4
226228
with:
227229
node-version: ${{ matrix.node }}
228230
cache: 'yarn'
229231

230232
- name: Install deps
231233
run: yarn install
232234

233-
- uses: actions/download-artifact@v2
235+
- uses: actions/download-artifact@v4
234236
with:
235237
name: package
236238
path: packages/toolkit

docs/api/configureStore.mdx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,15 @@ An optional initial state value to be passed to the Redux `createStore` function
154154

155155
### `enhancers`
156156

157-
An optional array of Redux store enhancers, or a callback function to customize the array of enhancers.
157+
A callback function to customize the array of enhancers.
158158

159-
If defined as an array, these will be passed to [the Redux `compose` function](https://redux.js.org/api/compose), and the combined enhancer will be passed to `createStore`.
159+
Enhancers returned by this callback will be passed to [the Redux `compose` function](https://redux.js.org/api/compose), and the combined enhancer will be passed to `createStore`.
160160

161161
:::tip Dev Tools
162162
This should _not_ include the Redux DevTools Extension `composeWithDevTools`, as this is already handled by `configureStore`.
163163

164-
Example: `enhancers: new Tuple(offline)` will result in a final setup of `[offline, devToolsExtension]`.
164+
Example: `enhancers: () => new Tuple(offline)` will result in a final setup of `[offline, devToolsExtension]`.
165+
:::
165166

166167
If not provided, `configureStore` will call `getDefaultEnhancers` and use the array of enhancers it returns (including `applyMiddleware` with specified middleware).
167168

@@ -174,7 +175,7 @@ For more details on how the `enhancer` parameter works and the list of enhancers
174175
175176
:::caution Middleware
176177
177-
If you provide an array, this `applyMiddleware` enhancer will _not_ be used.
178+
If you don't use `getDefaultEnhancers` and instead return an array, the `applyMiddleware` enhancer will _not_ be used.
178179
179180
`configureStore` will warn in console if any middleware are provided (or left as default) but not included in the final list of enhancers.
180181
@@ -196,23 +197,24 @@ configureStore({
196197
configureStore({
197198
reducer,
198199
middleware: () => [],
199-
enhancers: () => [offline(offlineConfig)],
200+
enhancers: () => [offline(offlineConfig)],
200201
})
201202
```
202203

204+
Note that if using Typescript, the `middleware` option is required to be provided _before_ the enhancer option, as the type of `getDefaultEnhancers` depends on its result.
205+
203206
:::
204207

205208
:::note Tuple
206209
Typescript users are required to use a `Tuple` instance (if not using a `getDefaultEnhancer` result, which is already a `Tuple`), for better inference.
207210

208-
```
211+
```ts no-transpile
209212
import { configureStore, Tuple } from '@reduxjs/toolkit'
210213

211214
configureStore({
212-
reducer: rootReducer,
213-
enhancers: () => new Tuple(offline),
215+
reducer: rootReducer,
216+
enhancers: () => new Tuple(offline),
214217
})
215-
216218
```
217219
218220
Javascript-only users are free to use a plain array if preferred.

docs/api/getDefaultEnhancers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If you want to customise the list of enhancers, you can supply an array of enhan
2828
```js
2929
const store = configureStore({
3030
reducer: rootReducer,
31-
enhancers: [offline(offlineConfig)],
31+
enhancers: () => new Tuple(offline(offlineConfig)),
3232
})
3333

3434
// store specifically has the offline enhancer applied

docs/rtk-query/api/created-api/hooks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ type UseQueryResult<T> = {
277277
isSuccess: boolean // Query has data from a successful load.
278278
isError: boolean // Query is currently in an "error" state.
279279

280-
refetch: () => void // A function to force refetch the query
280+
refetch: () => QueryActionCreatorResult // A function to force refetch the query - returns a Promise with additional methods
281281
}
282282
```
283283

0 commit comments

Comments
 (0)