Skip to content

Commit fc96831

Browse files
committed
Merge branch 'v2.0-integration' into dynamic-middleware-2
2 parents d933f65 + 4249786 commit fc96831

28 files changed

+208
-276
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
fail-fast: false
106106
matrix:
107107
node: ['16.x']
108-
ts: ['4.1', '4.2', '4.3', '4.4', '4.5', '4.6', '4.7', '4.8', '4.9.2-rc']
108+
ts: ['4.7', '4.8', '4.9', '5.0']
109109
steps:
110110
- name: Checkout repo
111111
uses: actions/checkout@v2

docs/api/immutabilityMiddleware.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ interface ImmutableStateInvariantMiddlewareOptions {
3636
ignoredPaths?: (string | RegExp)[]
3737
/** Print a warning if checks take longer than N ms. Default: 32ms */
3838
warnAfter?: number
39-
// @deprecated. Use ignoredPaths
40-
ignore?: string[]
4139
}
4240
```
4341

docs/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"@manaflair/redux-batch": "^1.0.0",
55
"@types/nanoid": "^2.1.0",
66
"@types/react": "^18.0",
7-
"@types/redux-logger": "^3.0.8",
87
"async-mutex": "^0.3.2",
98
"axios": "^0.20.0",
109
"formik": "^2.1.5",

docs/rtk-query/usage/customizing-create-api.mdx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@ You can create your own versions of `createApi` by either specifying non-default
1919

2020
## Customizing the React-Redux Hooks
2121

22-
If you want the hooks to use different versions of `useSelector` or `useDispatch`, such as if you are using a custom context, you can pass these in at module creation:
22+
If you want the hooks to use different versions of `useSelector`, `useDispatch` and `useStore`, such as if you are using a custom context, you can pass these in at module creation:
2323

2424
```ts
2525
import * as React from 'react'
26-
import { createDispatchHook, ReactReduxContextValue } from 'react-redux'
26+
import {
27+
createDispatchHook,
28+
createSelectorHook,
29+
createStoreHook,
30+
ReactReduxContextValue,
31+
} from 'react-redux'
2732
import {
2833
buildCreateApi,
2934
coreModule,
@@ -33,7 +38,13 @@ import {
3338
const MyContext = React.createContext<ReactReduxContextValue>(null as any)
3439
const customCreateApi = buildCreateApi(
3540
coreModule(),
36-
reactHooksModule({ useDispatch: createDispatchHook(MyContext) })
41+
reactHooksModule({
42+
hooks: {
43+
useDispatch: createDispatchHook(MyContext),
44+
useSelector: createSelectorHook(MyContext),
45+
useStore: createStoreHook(MyContext),
46+
},
47+
})
3748
)
3849
```
3950

@@ -81,7 +92,7 @@ export const myModule = (): Module<CustomModule> => ({
8192

8293
return {
8394
injectEndpoint(endpoint, definition) {
84-
const anyApi = (api as any) as Api<
95+
const anyApi = api as any as Api<
8596
any,
8697
Record<string, any>,
8798
string,

docs/rtk-query/usage/error-handling.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,13 @@ export const rtkQueryErrorLogger: Middleware =
9393
// RTK Query uses `createAsyncThunk` from redux-toolkit under the hood, so we're able to utilize these matchers!
9494
if (isRejectedWithValue(action)) {
9595
console.warn('We got a rejected action!')
96-
toast.warn({ title: 'Async error!', message: action.error.data.message })
96+
toast.warn({
97+
title: 'Async error!',
98+
message:
99+
'data' in action.error
100+
? (action.error.data as { message: string }).message
101+
: action.error.message,
102+
})
97103
}
98104

99105
return next(action)

docs/tsconfig.json

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,36 @@
1818
"baseUrl": "..",
1919
"jsx": "preserve",
2020
"paths": {
21-
"react": [ "../node_modules/@types/react" ],
22-
"react-dom": [ "../node_modules/@types/react-dom" ],
23-
"@reduxjs/toolkit": ["packages/toolkit/src/index.ts"],
24-
"@reduxjs/toolkit/query": ["packages/toolkit/src/query/index.ts"],
21+
"react": [
22+
"../node_modules/@types/react"
23+
],
24+
"react-dom": [
25+
"../node_modules/@types/react-dom"
26+
],
27+
"@reduxjs/toolkit": [
28+
"packages/toolkit/src/index.ts"
29+
],
30+
"@reduxjs/toolkit/query": [
31+
"packages/toolkit/src/query/index.ts"
32+
],
2533
"@reduxjs/toolkit/query/react": [
2634
"packages/toolkit/src/query/react/index.ts"
2735
],
28-
"@reduxjs/toolkit/dist/query/*": ["packages/toolkit/src/query/*"],
29-
"@virtual/*": ["docs/virtual/*"],
30-
"your-cool-library": ["docs/virtual/your-cool-library/index.ts"],
31-
"petstore-api.generated": ["docs/virtual/petstore-api.generated/index.ts"]
36+
"@reduxjs/toolkit/dist/query/*": [
37+
"packages/toolkit/src/query/*"
38+
],
39+
"@virtual/*": [
40+
"docs/virtual/*"
41+
],
42+
"your-cool-library": [
43+
"docs/virtual/your-cool-library/index.ts"
44+
],
45+
"redux-logger": [
46+
"docs/virtual/redux-logger/index.ts"
47+
],
48+
"petstore-api.generated": [
49+
"docs/virtual/petstore-api.generated/index.ts"
50+
]
3251
}
3352
}
34-
}
53+
}

docs/virtual/redux-logger/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { Middleware } from 'redux'
2+
3+
declare const logger: Middleware
4+
5+
export { logger }
6+
7+
export default logger

packages/toolkit/src/createSlice.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,6 @@ import type { Id, NoInfer, Tail } from './tsHelpers'
1919
import { freezeDraftable } from './utils'
2020
import type { CombinedSliceReducer, InjectConfig } from './combineSlices'
2121

22-
let hasWarnedAboutObjectNotation = false
23-
24-
/**
25-
* An action creator attached to a slice.
26-
*
27-
* @deprecated please use PayloadActionCreator directly
28-
*
29-
* @public
30-
*/
31-
export type SliceActionCreator<P> = PayloadActionCreator<P>
32-
3322
/**
3423
* The return value of `createSlice`
3524
*

packages/toolkit/src/devtoolsExtension.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,6 @@ export interface DevToolsEnhancerOptions {
9090
* function which takes `state` object and index as arguments, and should return `state` object back.
9191
*/
9292
stateSanitizer?: <S>(state: S, index: number) => S
93-
/**
94-
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
95-
* If `actionsWhitelist` specified, `actionsBlacklist` is ignored.
96-
* @deprecated Use actionsDenylist instead.
97-
*/
98-
actionsBlacklist?: string | string[]
99-
/**
100-
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
101-
* If `actionsWhitelist` specified, `actionsBlacklist` is ignored.
102-
* @deprecated Use actionsAllowlist instead.
103-
*/
104-
actionsWhitelist?: string | string[]
10593
/**
10694
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
10795
* If `actionsAllowlist` specified, `actionsDenylist` is ignored.

packages/toolkit/src/immutableStateInvariantMiddleware.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ export interface ImmutableStateInvariantMiddlewareOptions {
167167
ignoredPaths?: IgnorePaths
168168
/** Print a warning if checks take longer than N ms. Default: 32ms */
169169
warnAfter?: number
170-
// @deprecated. Use ignoredPaths
171-
ignore?: string[]
172170
}
173171

174172
/**
@@ -226,12 +224,8 @@ export function createImmutableStateInvariantMiddleware(
226224
isImmutable = isImmutableDefault,
227225
ignoredPaths,
228226
warnAfter = 32,
229-
ignore,
230227
} = options
231228

232-
// Alias ignore->ignoredPaths, but prefer ignoredPaths if present
233-
ignoredPaths = ignoredPaths || ignore
234-
235229
const track = trackForMutations.bind(null, isImmutable, ignoredPaths)
236230

237231
return ({ getState }) => {

0 commit comments

Comments
 (0)