You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by kg...@apache.org on 2023/06/12 17:13:45 UTC
[superset] branch master updated: chore: Disable redux errors (#24362)
This is an automated email from the ASF dual-hosted git repository.
kgabryje pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new e4bb4a4771 chore: Disable redux errors (#24362)
e4bb4a4771 is described below
commit e4bb4a477164c8060ee1f85b0a97158bbedb502f
Author: Kamil Gabryjelski <ka...@gmail.com>
AuthorDate: Mon Jun 12 19:13:36 2023 +0200
chore: Disable redux errors (#24362)
---
superset-frontend/src/views/store.ts | 30 ++++++++++++++++++------------
superset-frontend/webpack.config.js | 2 ++
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/superset-frontend/src/views/store.ts b/superset-frontend/src/views/store.ts
index 78d5a99714..193386a5ff 100644
--- a/superset-frontend/src/views/store.ts
+++ b/superset-frontend/src/views/store.ts
@@ -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';
@@ -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
@@ -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,
});
diff --git a/superset-frontend/webpack.config.js b/superset-frontend/webpack.config.js
index cf61a352ed..f728ce23df 100644
--- a/superset-frontend/webpack.config.js
+++ b/superset-frontend/webpack.config.js
@@ -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({