Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Disable redux errors #24362

Merged
merged 1 commit into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions superset-frontend/src/views/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/
import { configureStore, ConfigureStoreOptions, Store } from '@reduxjs/toolkit';
import thunk from 'redux-thunk';
import { api } from 'src/hooks/apiResources/queryApi';
import messageToastReducer from 'src/components/MessageToasts/reducers';
import charts from 'src/components/Chart/chartReducer';
Expand Down Expand Up @@ -75,6 +76,22 @@ const userReducer = (
return user;
};

const getMiddleware: ConfigureStoreOptions['middleware'] =
getDefaultMiddleware =>
process.env.REDUX_DEFAULT_MIDDLEWARE
? getDefaultMiddleware({
immutableCheck: {
warnAfter: 200,
},
serializableCheck: {
// Ignores AbortController instances
ignoredActionPaths: [/queryController/g],
ignoredPaths: [/queryController/g],
warnAfter: 200,
},
}).concat(logger, api.middleware)
: [thunk, logger, api.middleware];

// TODO: This reducer is a combination of the Dashboard and Explore reducers.
// The correct way of handling this is to unify the actions and reducers from both
// modules in shared files. This involves a big refactor to unify the parameter types
Expand Down Expand Up @@ -137,18 +154,7 @@ export function setupStore({
[api.reducerPath]: api.reducer,
...rootReducers,
},
middleware: getDefaultMiddleware =>
getDefaultMiddleware({
immutableCheck: {
warnAfter: 200,
},
serializableCheck: {
// Ignores AbortController instances
ignoredActionPaths: [/queryController/g],
ignoredPaths: [/queryController/g],
warnAfter: 200,
},
}).concat(logger, api.middleware),
middleware: getMiddleware,
devTools: process.env.WEBPACK_MODE === 'development' && !disableDebugger,
...overrides,
});
Expand Down
2 changes: 2 additions & 0 deletions superset-frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ const plugins = [
// expose mode variable to other modules
new webpack.DefinePlugin({
'process.env.WEBPACK_MODE': JSON.stringify(mode),
'process.env.REDUX_DEFAULT_MIDDLEWARE':
process.env.REDUX_DEFAULT_MIDDLEWARE,
}),

new CopyPlugin({
Expand Down