From 9588e08a00bda419ca83d79a11c7e310cad8f59c Mon Sep 17 00:00:00 2001 From: Jesse Hallam Date: Wed, 28 Jun 2023 15:41:32 -0300 Subject: [PATCH] enable redux-devtools in all environments (#23867) * enable redux-devools in all environments [Redux DevTools](https://github.com/reduxjs/redux-devtools) gives developers and users insight into the client-side state of the Mattermost application. Instead of restricting this to developer builds, allow it for production builds too, simplifyin debugging when an issue reproduces in production but not in a development environment. There is no performance overhead unless the devtools are installed and opened by the enduser. There is should be no security impact, since all this information is already client-side. Furthermore, major websites expose Redux in production: e.g. https://cbc.ca and https://medium.com/. * preserve window.store for all environments, not as a supported API --- .../packages/mattermost-redux/src/store/configureStore.ts | 4 ++-- webapp/channels/src/stores/redux_store.jsx | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/webapp/channels/src/packages/mattermost-redux/src/store/configureStore.ts b/webapp/channels/src/packages/mattermost-redux/src/store/configureStore.ts index 506e476a53..77123b586b 100644 --- a/webapp/channels/src/packages/mattermost-redux/src/store/configureStore.ts +++ b/webapp/channels/src/packages/mattermost-redux/src/store/configureStore.ts @@ -8,7 +8,7 @@ import { Store, } from 'redux'; import thunk from 'redux-thunk'; -import {composeWithDevToolsDevelopmentOnly} from '@redux-devtools/extension'; +import {composeWithDevTools} from '@redux-devtools/extension'; import {GlobalState} from '@mattermost/types/store'; @@ -39,7 +39,7 @@ export default function configureStore({ ...preloadedState, }; - const composeEnhancers = composeWithDevToolsDevelopmentOnly({ + const composeEnhancers = composeWithDevTools({ shouldHotReload: false, trace: true, traceLimit: 25, diff --git a/webapp/channels/src/stores/redux_store.jsx b/webapp/channels/src/stores/redux_store.jsx index 4cac262f59..8a38c976d7 100644 --- a/webapp/channels/src/stores/redux_store.jsx +++ b/webapp/channels/src/stores/redux_store.jsx @@ -8,9 +8,8 @@ import configureStore from 'store'; const store = configureStore(); -// eslint-disable-next-line no-process-env -if (process.env.NODE_ENV !== 'production' || window.location.origin === 'https://community.mattermost.com') { - window.store = store; -} +// Export the store to simplify debugging in production environments. This is not a supported API, +// and should not be relied upon by plugins. +window.store = store; export default store;