You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of RTK 2.0, the `autoBatchEnhancer` is included by default when calling `configureStore`.
74
+
75
+
This means to configure it, you should instead pass an callback that receives `getDefaultEnhancers` and calls it with your desired settings.
76
+
77
+
```tstitle="Configuring autoBatchEnhancer with getDefaultEnhancers"
78
+
import { configureStore } from'@reduxjs/toolkit'
79
+
80
+
const store =configureStore({
81
+
reducer: () =>0,
82
+
enhancers: (getDefaultEnhancers) =>
83
+
getDefaultEnhancers({
84
+
autoBatch: { type: 'tick' },
85
+
}),
86
+
})
87
+
```
88
+
89
+
:::
90
+
77
91
Creates a new instance of the autobatch store enhancer.
78
92
79
93
Any action that is tagged with `action.meta[SHOULD_AUTOBATCH] = true` will be treated as "low-priority", and a notification callback will be queued. The enhancer will delay notifying subscribers until either:
@@ -140,4 +154,4 @@ This allows Redux users to selectively tag certain actions for effective batchin
RTK Query already marks several of its key internal action types as batchable. By adding the `autoBatchEnhancer` to the store setup, it improves the overall UI performance, especially when rendering large lists of components that use the RTKQ query hooks.
0 commit comments