From 88e4f7eb66f812613217f217cb745700efb89ceb Mon Sep 17 00:00:00 2001 From: KEVIN KOECH Date: Fri, 20 Oct 2023 20:50:29 +0300 Subject: [PATCH 1/3] Update ConfiguringYourStore.md `getDefaultMiddleware` has been marked as deprecated. Prefer to use the callback notation for the middleware option in configureStore to access a pre-typed getDefaultMiddleware instead. --- docs/usage/ConfiguringYourStore.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/usage/ConfiguringYourStore.md b/docs/usage/ConfiguringYourStore.md index 461967c76a..dc572ac355 100644 --- a/docs/usage/ConfiguringYourStore.md +++ b/docs/usage/ConfiguringYourStore.md @@ -347,7 +347,7 @@ By default, `configureStore` from Redux Toolkit will: Here's what the hot reloading example might look like using Redux Toolkit: ```js -import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit' +import { configureStore } from '@reduxjs/toolkit' import monitorReducersEnhancer from './enhancers/monitorReducers' import loggerMiddleware from './middleware/logger' @@ -356,7 +356,7 @@ import rootReducer from './reducers' export default function configureAppStore(preloadedState) { const store = configureStore({ reducer: rootReducer, - middleware: [loggerMiddleware, ...getDefaultMiddleware()], + middleware: (getDefaultMiddleware) => [loggerMiddleware, ...getDefaultMiddleware()], preloadedState, enhancers: [monitorReducersEnhancer] }) From 18598c92d702c27d4fd1ca62663645ac7f5d8eb9 Mon Sep 17 00:00:00 2001 From: KEVIN KOECH Date: Sat, 21 Oct 2023 08:32:18 +0300 Subject: [PATCH 2/3] Update ConfiguringYourStore.md Update to use specialized `getDefaultMiddleware().prepend()` to correctly preserve the types of the middleware in Typescript. --- docs/usage/ConfiguringYourStore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage/ConfiguringYourStore.md b/docs/usage/ConfiguringYourStore.md index dc572ac355..4508c74273 100644 --- a/docs/usage/ConfiguringYourStore.md +++ b/docs/usage/ConfiguringYourStore.md @@ -356,7 +356,7 @@ import rootReducer from './reducers' export default function configureAppStore(preloadedState) { const store = configureStore({ reducer: rootReducer, - middleware: (getDefaultMiddleware) => [loggerMiddleware, ...getDefaultMiddleware()], + middleware: (getDefaultMiddleware) => [loggerMiddleware, ...getDefaultMiddleware().prepend()], preloadedState, enhancers: [monitorReducersEnhancer] }) From 81f62d04729068dd83223a02fc2def8b6bf40ced Mon Sep 17 00:00:00 2001 From: KEVIN KOECH Date: Tue, 7 Nov 2023 10:30:19 +0300 Subject: [PATCH 3/3] Update ConfiguringYourStore.md Update documentation to use `getDefaultMiddleware().prepend(loggerMiddleware)` --- docs/usage/ConfiguringYourStore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage/ConfiguringYourStore.md b/docs/usage/ConfiguringYourStore.md index 4508c74273..ea85cf3b7d 100644 --- a/docs/usage/ConfiguringYourStore.md +++ b/docs/usage/ConfiguringYourStore.md @@ -356,7 +356,7 @@ import rootReducer from './reducers' export default function configureAppStore(preloadedState) { const store = configureStore({ reducer: rootReducer, - middleware: (getDefaultMiddleware) => [loggerMiddleware, ...getDefaultMiddleware().prepend()], + middleware: (getDefaultMiddleware) => getDefaultMiddleware().prepend(loggerMiddleware), preloadedState, enhancers: [monitorReducersEnhancer] })