Skip to content

Commit 7379cc2

Browse files
committed
Merge branch 'create-slice-creators' into entity-methods-creator
2 parents a687ebf + 0133506 commit 7379cc2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+20802
-20257
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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ 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: |
2323
codegen:
2424
- 'packages/rtk-query-codegen-openapi/**'
25+
- 'yarn.lock'
2526
2627
build:
2728
needs: changes
@@ -34,9 +35,9 @@ jobs:
3435
node-version: ['20.x']
3536

3637
steps:
37-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v4
3839
- name: Use Node.js ${{ matrix.node-version }}
39-
uses: actions/setup-node@v2
40+
uses: actions/setup-node@v4
4041
with:
4142
node-version: ${{ matrix.node }}
4243
cache: 'yarn'

.github/workflows/tests.yml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ 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: |
1919
toolkit:
2020
- 'packages/toolkit/**'
2121
- 'examples/publish-ci/**'
2222
- '.github/workflows/tests.yml'
23+
- 'yarn.lock'
2324
2425
build:
2526
needs: changes
@@ -34,10 +35,10 @@ jobs:
3435

3536
steps:
3637
- name: Checkout repo
37-
uses: actions/checkout@v2
38+
uses: actions/checkout@v4
3839

3940
- name: Use node ${{ matrix.node }}
40-
uses: actions/setup-node@v2
41+
uses: actions/setup-node@v4
4142
with:
4243
node-version: ${{ matrix.node }}
4344
cache: 'yarn'
@@ -55,7 +56,7 @@ jobs:
5556
- name: Pack
5657
run: yarn pack
5758

58-
- uses: actions/upload-artifact@v2
59+
- uses: actions/upload-artifact@v4
5960
with:
6061
name: package
6162
path: packages/toolkit/package.tgz
@@ -70,18 +71,18 @@ jobs:
7071
node: ['20.x']
7172
steps:
7273
- name: Checkout repo
73-
uses: actions/checkout@v2
74+
uses: actions/checkout@v4
7475

7576
- name: Use node ${{ matrix.node }}
76-
uses: actions/setup-node@v2
77+
uses: actions/setup-node@v4
7778
with:
7879
node-version: ${{ matrix.node }}
7980
cache: 'yarn'
8081

8182
- name: Install deps
8283
run: yarn install
8384

84-
- uses: actions/download-artifact@v2
85+
- uses: actions/download-artifact@v4
8586
with:
8687
name: package
8788
path: packages/toolkit
@@ -108,10 +109,10 @@ jobs:
108109
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3']
109110
steps:
110111
- name: Checkout repo
111-
uses: actions/checkout@v2
112+
uses: actions/checkout@v4
112113

113114
- name: Use node ${{ matrix.node }}
114-
uses: actions/setup-node@v2
115+
uses: actions/setup-node@v4
115116
with:
116117
node-version: ${{ matrix.node }}
117118
cache: 'yarn'
@@ -122,7 +123,7 @@ jobs:
122123
- name: Install TypeScript ${{ matrix.ts }}
123124
run: yarn add typescript@${{ matrix.ts }}
124125

125-
- uses: actions/download-artifact@v2
126+
- uses: actions/download-artifact@v4
126127
with:
127128
name: package
128129
path: packages/toolkit
@@ -164,13 +165,13 @@ jobs:
164165
run:
165166
working-directory: ./examples/publish-ci/${{ matrix.example }}
166167
env:
167-
YARN_ENABLE_IMMUTABLE_INSTALLS: "false"
168+
YARN_ENABLE_IMMUTABLE_INSTALLS: false
168169
steps:
169170
- name: Checkout repo
170-
uses: actions/checkout@v2
171+
uses: actions/checkout@v4
171172

172173
- name: Use node ${{ matrix.node }}
173-
uses: actions/setup-node@v2
174+
uses: actions/setup-node@v4
174175
with:
175176
node-version: ${{ matrix.node }}
176177
cache: 'yarn'
@@ -181,7 +182,7 @@ jobs:
181182
- name: Remove existing RTK
182183
run: yarn remove @reduxjs/toolkit
183184

184-
- uses: actions/download-artifact@v2
185+
- uses: actions/download-artifact@v4
185186
with:
186187
name: package
187188
path: ./examples/publish-ci/${{ matrix.example }}
@@ -197,13 +198,15 @@ jobs:
197198

198199
- name: Set up JDK 17 for React Native build
199200
if: matrix.example == 'react-native' || matrix.example == 'expo'
200-
uses: actions/setup-java@v2
201+
uses: actions/setup-java@v4
201202
with:
202203
java-version: '17.x'
203204
distribution: 'temurin'
204205

205206
- name: Build example
206-
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
207+
env:
208+
NODE_OPTIONS: --openssl-legacy-provider
209+
run: yarn build
207210

208211
- name: Run test step
209212
run: yarn test
@@ -219,18 +222,18 @@ jobs:
219222
node: ['20.x']
220223
steps:
221224
- name: Checkout repo
222-
uses: actions/checkout@v2
225+
uses: actions/checkout@v4
223226

224227
- name: Use node ${{ matrix.node }}
225-
uses: actions/setup-node@v2
228+
uses: actions/setup-node@v4
226229
with:
227230
node-version: ${{ matrix.node }}
228231
cache: 'yarn'
229232

230233
- name: Install deps
231234
run: yarn install
232235

233-
- uses: actions/download-artifact@v2
236+
- uses: actions/download-artifact@v4
234237
with:
235238
name: package
236239
path: packages/toolkit

docs/api/autoBatchEnhancer.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Any action that is tagged with `action.meta[SHOULD_AUTOBATCH] = true` will be tr
9999

100100
- `{type: 'raf'}`: queues using `requestAnimationFrame` (default)
101101
- `{type: 'tick'}`: queues using `queueMicrotask`
102-
- `{type: 'timer, timeout: number}`: queues using `setTimeout`
102+
- `{type: 'timer', timeout: number}`: queues using `setTimeout`
103103
- `{type: 'callback', queueNotification: (notify: () => void) => void}`: lets you provide your own callback, such as a debounced or throttled function
104104

105105
The default behavior is to queue the notifications using `requestAnimationFrame`.

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.

0 commit comments

Comments
 (0)