mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Redux: Added config to redux development middlewares that checks for mutations and serializability (#23492)
* Redux: Added config to redux development middlewares that checks for mutations and serializability * Disable these middlewares, they are too slow * Update public/app/store/configureStore.ts * Update public/app/store/configureStore.ts * Prettier fix Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
This commit is contained in:
parent
a56615749a
commit
1468bab360
@ -1,7 +1,6 @@
|
||||
import { configureStore as reduxConfigureStore, getDefaultMiddleware } from '@reduxjs/toolkit';
|
||||
import { createLogger } from 'redux-logger';
|
||||
import thunk, { ThunkMiddleware } from 'redux-thunk';
|
||||
|
||||
import { ThunkMiddleware } from 'redux-thunk';
|
||||
import { setStore } from './store';
|
||||
import { StoreState } from 'app/types/store';
|
||||
import { toggleLogActionsMiddleware } from 'app/core/middlewares/application';
|
||||
@ -22,11 +21,17 @@ export function configureStore() {
|
||||
},
|
||||
});
|
||||
|
||||
const middleware = process.env.NODE_ENV !== 'production' ? [toggleLogActionsMiddleware, thunk, logger] : [thunk];
|
||||
const middleware = process.env.NODE_ENV !== 'production' ? [toggleLogActionsMiddleware, logger] : [];
|
||||
|
||||
const reduxDefaultMiddleware = getDefaultMiddleware<StoreState>({
|
||||
thunk: true,
|
||||
serializableCheck: false,
|
||||
immutableCheck: false,
|
||||
} as any);
|
||||
|
||||
const store = reduxConfigureStore<StoreState>({
|
||||
reducer: createRootReducer(),
|
||||
middleware: [...getDefaultMiddleware<StoreState>(), ...middleware] as [ThunkMiddleware<StoreState>],
|
||||
middleware: [...reduxDefaultMiddleware, ...middleware] as [ThunkMiddleware<StoreState>],
|
||||
devTools: process.env.NODE_ENV !== 'production',
|
||||
preloadedState: {
|
||||
navIndex: buildInitialState(),
|
||||
@ -36,3 +41,41 @@ export function configureStore() {
|
||||
setStore(store);
|
||||
return store;
|
||||
}
|
||||
|
||||
/*
|
||||
function getActionsToIgnoreSerializableCheckOn() {
|
||||
return [
|
||||
'dashboard/setPanelAngularComponent',
|
||||
'dashboard/panelModelAndPluginReady',
|
||||
'dashboard/dashboardInitCompleted',
|
||||
'plugins/panelPluginLoaded',
|
||||
'explore/initializeExplore',
|
||||
'explore/changeRange',
|
||||
'explore/updateDatasourceInstance',
|
||||
'explore/queryStoreSubscription',
|
||||
'explore/queryStreamUpdated',
|
||||
];
|
||||
}
|
||||
|
||||
function getPathsToIgnoreMutationAndSerializableCheckOn() {
|
||||
return [
|
||||
'plugins.panels',
|
||||
'dashboard.panels',
|
||||
'dashboard.getModel',
|
||||
'payload.plugin',
|
||||
'panelEditorNew.getPanel',
|
||||
'panelEditorNew.getSourcePanel',
|
||||
'panelEditorNew.getData',
|
||||
'explore.left.queryResponse',
|
||||
'explore.right.queryResponse',
|
||||
'explore.left.datasourceInstance',
|
||||
'explore.right.datasourceInstance',
|
||||
'explore.left.range',
|
||||
'explore.left.eventBridge',
|
||||
'explore.right.eventBridge',
|
||||
'explore.right.range',
|
||||
'explore.left.querySubscription',
|
||||
'explore.right.querySubscription',
|
||||
];
|
||||
}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user