Skip to content

Commit e91e910

Browse files
committed
Merge branch 'master' of github.com:reduxjs/redux-toolkit
2 parents 247f9fe + 309c4bd commit e91e910

File tree

10 files changed

+512
-1542
lines changed

10 files changed

+512
-1542
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ jobs:
2121
- uses: c-hive/gha-npm-cache@v1
2222

2323
- name: Install deps
24-
run: npm ci --ignore-scripts
24+
run: npm ci
2525

2626
- name: Pack (including Prepare)
2727
run: npm pack
28+
env:
29+
NODE_ENV: 'production' # this doesn't actually matter, so just set it to production
2830

2931
- uses: actions/upload-artifact@v2
3032
with:

docs/api/createAsyncThunk.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ An object with the following optional fields:
8989

9090
- `condition`: a callback that can be used to skip execution of the payload creator and all action dispatches, if desired. See [Canceling Before Execution](#canceling-before-execution) for a complete description.
9191
- `dispatchConditionRejection`: if `condition()` returns `false`, the default behavior is that no actions will be dispatched at all. If you still want a "rejected" action to be dispatched when the thunk was canceled, set this flag to `true`.
92+
- `idGenerator`: a function to use when generating the `requestId` for the request sequence. Defaults to use [nanoid](./otherExports.mdx/#nanoid).
9293

9394
## Return Value
9495

docs/api/otherExports.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Redux Toolkit exports some of its internal utilities, and re-exports additional
1111

1212
### `nanoid`
1313

14-
An inlined copy of [`nanoid/nonsecure`](https://github.com/ai/nanoid). Generates a non-cryptographically-secure random ID string. Automatically used by `createAsyncThunk` for request IDs, but may also be useful for other cases as well.
14+
An inlined copy of [`nanoid/nonsecure`](https://github.com/ai/nanoid). Generates a non-cryptographically-secure random ID string. `createAsyncThunk` uses this by default for request IDs. May also be useful for other cases as well.
1515

1616
```ts
1717
import { nanoid } from '@reduxjs/toolkit'

etc/redux-toolkit.api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,14 @@ export type AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig extends AsyncThu
8585
abort(reason?: string): void;
8686
requestId: string;
8787
arg: ThunkArg;
88+
unwrap(): Promise<Returned>;
8889
};
8990

9091
// @public
9192
export interface AsyncThunkOptions<ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}> {
9293
condition?(arg: ThunkArg, api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>): boolean | undefined;
9394
dispatchConditionRejection?: boolean;
95+
idGenerator?: () => string;
9496
// (undocumented)
9597
serializeError?: (x: unknown) => GetSerializedErrorType<ThunkApiConfig>;
9698
}

0 commit comments

Comments
 (0)