@@ -169,8 +169,8 @@ import { configureStore } from '@reduxjs/toolkit'
169
169
// We'll use redux-logger just as an example of adding another middleware
170
170
import logger from 'redux-logger'
171
171
172
- // And use redux-batch as an example of adding enhancers
173
- import { reduxBatch } from '@manaflair/ redux-batch '
172
+ // And use redux-batched-subscribe as an example of adding enhancers
173
+ import { batchedSubscribe } from 'redux-batched-subscribe '
174
174
175
175
import todosReducer from './todos/todosReducer'
176
176
import visibilityReducer from './visibility/visibilityReducer'
@@ -194,17 +194,19 @@ const preloadedState = {
194
194
visibilityFilter: 'SHOW_COMPLETED',
195
195
}
196
196
197
+ const debounceNotify = _.debounce(notify => notify());
198
+
197
199
const store = configureStore({
198
200
reducer,
199
201
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(logger),
200
202
devTools: process.env.NODE_ENV !== 'production',
201
203
preloadedState,
202
- enhancers: [reduxBatch ],
204
+ enhancers: [batchedSubscribe(debounceNotify) ],
203
205
})
204
206
205
207
// The store has been created with these options:
206
208
// - The slice reducers were automatically passed to combineReducers()
207
209
// - redux-thunk and redux-logger were added as middleware
208
210
// - The Redux DevTools Extension is disabled for production
209
- // - The middleware, batch , and devtools enhancers were composed together
211
+ // - The middleware, batched subscribe , and devtools enhancers were composed together
210
212
` ` `
0 commit comments