Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into update-oazapfts
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonEggert committed Mar 13, 2024
2 parents a28a890 + e31224f commit f1ec95c
Show file tree
Hide file tree
Showing 19 changed files with 18,780 additions and 18,741 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: EskiMojo14/size-limit-action@v2
with:
directory: packages/toolkit
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
outputs:
codegen: ${{ steps.filter.outputs.codegen }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
Expand All @@ -34,9 +34,9 @@ jobs:
node-version: ['20.x']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
Expand Down
42 changes: 22 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
outputs:
toolkit: ${{ steps.filter.outputs.toolkit }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
Expand All @@ -34,10 +34,10 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
Expand All @@ -55,7 +55,7 @@ jobs:
- name: Pack
run: yarn pack

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: package
path: packages/toolkit/package.tgz
Expand All @@ -70,18 +70,18 @@ jobs:
node: ['20.x']
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install deps
run: yarn install

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: package
path: packages/toolkit
Expand All @@ -108,10 +108,10 @@ jobs:
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3']
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
Expand All @@ -122,7 +122,7 @@ jobs:
- name: Install TypeScript ${{ matrix.ts }}
run: yarn add typescript@${{ matrix.ts }}

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: package
path: packages/toolkit
Expand Down Expand Up @@ -164,13 +164,13 @@ jobs:
run:
working-directory: ./examples/publish-ci/${{ matrix.example }}
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: "false"
YARN_ENABLE_IMMUTABLE_INSTALLS: false
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
Expand All @@ -181,7 +181,7 @@ jobs:
- name: Remove existing RTK
run: yarn remove @reduxjs/toolkit

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

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

- name: Build example
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
env:
NODE_OPTIONS: --openssl-legacy-provider
run: yarn build

- name: Run test step
run: yarn test
Expand All @@ -219,18 +221,18 @@ jobs:
node: ['20.x']
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install deps
run: yarn install

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: package
path: packages/toolkit
Expand Down
20 changes: 11 additions & 9 deletions docs/api/configureStore.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,15 @@ An optional initial state value to be passed to the Redux `createStore` function

### `enhancers`

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

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`.
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`.

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

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

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

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

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.

:::

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

```
```ts no-transpile
import { configureStore, Tuple } from '@reduxjs/toolkit'

configureStore({
reducer: rootReducer,
enhancers: () => new Tuple(offline),
reducer: rootReducer,
enhancers: () => new Tuple(offline),
})

```
Javascript-only users are free to use a plain array if preferred.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/getDefaultEnhancers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you want to customise the list of enhancers, you can supply an array of enhan
```js
const store = configureStore({
reducer: rootReducer,
enhancers: [offline(offlineConfig)],
enhancers: () => new Tuple(offline(offlineConfig)),
})

// store specifically has the offline enhancer applied
Expand Down
2 changes: 1 addition & 1 deletion docs/rtk-query/api/created-api/hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ type UseQueryResult<T> = {
isSuccess: boolean // Query has data from a successful load.
isError: boolean // Query is currently in an "error" state.

refetch: () => void // A function to force refetch the query
refetch: () => QueryActionCreatorResult // A function to force refetch the query - returns a Promise with additional methods
}
```
Expand Down
Loading

0 comments on commit f1ec95c

Please sign in to comment.