Skip to content

Commit

Permalink
change ApiProvider context argument to match
Browse files Browse the repository at this point in the history
  • Loading branch information
EskiMojo14 committed Mar 29, 2024
1 parent 8b5d210 commit 7e854c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions packages/toolkit/src/dynamicMiddleware/tests/react.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@ describe('createReactDynamicMiddleware', () => {
render(<Component />, {
wrapper: ({ children }) => (
<Provider store={store}>
<Provider
context={context as React.Context<ReactReduxContextValue | null>}
store={store2}
>
<Provider context={context} store={store2}>
{children}
</Provider>
</Provider>
Expand Down
5 changes: 2 additions & 3 deletions packages/toolkit/src/query/react/ApiProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ export function ApiProvider<A extends Api<any, {}, any, any>>(props: {
children: any
api: A
setupListeners?: Parameters<typeof setupListeners>[1] | false
context?: Context<ReactReduxContextValue>
context?: Context<ReactReduxContextValue | null>
}) {
const context = (props.context ||
ReactReduxContext) as Context<ReactReduxContextValue | null>
const context = props.context || ReactReduxContext
const existingContext = useContext(context)
if (existingContext) {
throw new Error(
Expand Down

0 comments on commit 7e854c4

Please sign in to comment.