Skip to content

Commit 8f2508f

Browse files
committed
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit into rn-example-ci
2 parents f8d8d99 + 0ffabd9 commit 8f2508f

25 files changed

+1557
-270
lines changed

docs/api/createListenerMiddleware.mdx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -486,21 +486,16 @@ To fix this, the middleware provides types for defining "pre-typed" versions of
486486
```ts no-transpile
487487
// listenerMiddleware.ts
488488
import { createListenerMiddleware, addListener } from '@reduxjs/toolkit'
489-
import type { TypedStartListening, TypedAddListener } from '@reduxjs/toolkit'
490-
491489
import type { RootState, AppDispatch } from './store'
492490

493491
export const listenerMiddleware = createListenerMiddleware()
494492

495-
export type AppStartListening = TypedStartListening<RootState, AppDispatch>
496-
497-
export const startAppListening =
498-
listenerMiddleware.startListening as AppStartListening
499-
500-
export const addAppListener = addListener as TypedAddListener<
493+
export const startAppListening = listenerMiddleware.startListening.withTypes<
501494
RootState,
502495
AppDispatch
503-
>
496+
>()
497+
498+
export const addAppListener = addListener.withTypes<RootState, AppDispatch>()
504499
```
505500

506501
Then import and use those pre-typed methods in your components.

docs/api/createSlice.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,12 @@ Instead, import `buildCreateSlice` and `asyncThunkCreator`, and create your own
251251
```ts
252252
import { buildCreateSlice, asyncThunkCreator } from '@reduxjs/toolkit'
253253
254-
// name is up to you
255-
export const createSliceWithThunks = buildCreateSlice({
254+
export const createAppSlice = buildCreateSlice({
256255
creators: { asyncThunk: asyncThunkCreator },
257256
})
258257
```
259258

260-
Then import this `createSlice` as needed instead of the exported version from RTK.
259+
Then import this `createAppSlice` as needed instead of the exported version from RTK.
261260

262261
:::
263262

docs/usage/migrating-rtk-2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,11 +657,11 @@ In practice, we hope these are reasonable tradeoffs. Creating thunks inside of `
657657
Here's what the new callback syntax looks like:
658658

659659
```ts
660-
const createSliceWithThunks = buildCreateSlice({
660+
const createAppSlice = buildCreateSlice({
661661
creators: { asyncThunk: asyncThunkCreator },
662662
})
663663

664-
const todosSlice = createSliceWithThunks({
664+
const todosSlice = createAppSlice({
665665
name: 'todos',
666666
initialState: {
667667
loading: false,

docs/usage/nextjs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ The App Router has four seperate caches including `fetch` request and route cach
386386
export const dynamic = 'force-dynamic'
387387
```
388388

389-
After a mutation you should also invalidate the cache by calling (`revalidatePath`)[https://nextjs.org/docs/app/api-reference/functions/revalidatePath] or (`revalidateTag`)[https://nextjs.org/docs/app/api-reference/functions/revalidateTag] as appropriate.
389+
After a mutation you should also invalidate the cache by calling [`revalidatePath`](https://nextjs.org/docs/app/api-reference/functions/revalidatePath) or [`revalidateTag`](https://nextjs.org/docs/app/api-reference/functions/revalidateTag) as appropriate.
390390

391391
### RTK Query
392392

packages/rtk-codemods/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@reduxjs/rtk-codemods",
3-
"version": "0.0.3",
3+
"version": "0.1.0",
44
"scripts": {
55
"lint": "eslint --cache .",
66
"test": "vitest",
@@ -39,5 +39,9 @@
3939
},
4040
"publishConfig": {
4141
"access": "public"
42+
},
43+
"repository": {
44+
"type": "git",
45+
"url": "git+https://github.com/reduxjs/redux-toolkit.git"
4246
}
4347
}

packages/rtk-query-graphql-request-base-query/package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{
22
"name": "@rtk-query/graphql-request-base-query",
3-
"version": "2.2.0",
3+
"version": "2.3.1",
44
"author": {
55
"name": "Lenz Weber",
66
"email": "mail@phryneas.de",
77
"url": "https://phryneas.de/"
88
},
99
"license": "MIT",
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/reduxjs/redux-toolkit.git"
13+
},
1014
"type": "module",
1115
"source": "src/index.ts",
1216
"main": "./dist/index.cjs",
@@ -16,17 +20,18 @@
1620
"scripts": {
1721
"build": "microbundle",
1822
"prepack": "rimraf dist/*; yarn build",
19-
"dev": "microbundle watch"
23+
"dev": "microbundle watch",
24+
"test": "true"
2025
},
2126
"dependencies": {
22-
"graphql-request": "^4.0.0"
27+
"graphql-request": "^4.0.0 || ^5.0.0 || ^6.0.0"
2328
},
2429
"peerDependencies": {
25-
"@reduxjs/toolkit": "^1.7.1",
30+
"@reduxjs/toolkit": "^1.7.1 || ^2.0.0",
2631
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
2732
},
2833
"devDependencies": {
29-
"@reduxjs/toolkit": "^1.6.0",
34+
"@reduxjs/toolkit": "^1.6.0 || ^2.0.0",
3035
"graphql": "^16.5.0",
3136
"microbundle": "^0.13.3",
3237
"rimraf": "^3.0.2",

packages/toolkit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@testing-library/user-event": "^13.1.5",
5858
"@types/json-stringify-safe": "^5.0.0",
5959
"@types/nanoid": "^2.1.0",
60-
"@types/node": "^10.14.4",
60+
"@types/node": "^20.11.0",
6161
"@types/query-string": "^6.3.0",
6262
"@types/react": "^18.0.12",
6363
"@types/react-dom": "^18.0.5",
@@ -90,7 +90,7 @@
9090
"tsup": "^7.2.0",
9191
"tsx": "^3.12.2",
9292
"typescript": "5.2",
93-
"vitest": "^0.30.1",
93+
"vitest": "^1.1.3",
9494
"yargs": "^15.3.1"
9595
},
9696
"scripts": {

packages/toolkit/src/createSlice.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ interface AsyncThunkCreator<
350350
State,
351351
CurriedThunkApiConfig extends PreventCircular<AsyncThunkConfig> = PreventCircular<AsyncThunkConfig>
352352
> {
353-
<ThunkArg extends any, Returned = unknown>(
353+
<Returned, ThunkArg = void>(
354354
payloadCreator: AsyncThunkPayloadCreator<
355355
Returned,
356356
ThunkArg,
@@ -369,8 +369,8 @@ interface AsyncThunkCreator<
369369
CurriedThunkApiConfig
370370
>
371371
<
372-
ThunkArg extends any,
373-
Returned = unknown,
372+
Returned,
373+
ThunkArg,
374374
ThunkApiConfig extends PreventCircular<AsyncThunkConfig> = {}
375375
>(
376376
payloadCreator: AsyncThunkPayloadCreator<

0 commit comments

Comments
 (0)