diff --git a/src/init.js b/src/init.js index a104d0dce..122eeba6b 100644 --- a/src/init.js +++ b/src/init.js @@ -19,13 +19,15 @@ import reducers from './reducers/index.js'; import dispatcher from './dispatcher/index.js'; import TooltipProvider from './ui/components/TooltipProvider.js'; import config from './utils/processConfig.js'; +import {stateSanitizer} from './utils/reduxDevToolsConfig.js'; import {initLauncherHooks} from './utils/launcher.js'; import initCrashReporter from './utils/electronCrashReporter'; const path = require('path'); const store = createStore( reducers, - window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(), + window.__REDUX_DEVTOOLS_EXTENSION__ && + window.__REDUX_DEVTOOLS_EXTENSION__({stateSanitizer}), ); const logger = initLogger(store); diff --git a/src/utils/reduxDevToolsConfig.js b/src/utils/reduxDevToolsConfig.js new file mode 100644 index 000000000..1ca88309e --- /dev/null +++ b/src/utils/reduxDevToolsConfig.js @@ -0,0 +1,41 @@ +/** + * Copyright 2018-present Facebook. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * @format + */ + +export const stateSanitizer = state => { + let sanitizedState = state; + if (state.connections) { + if (state.connections.devices) { + const {devices} = state.connections; + sanitizedState = { + ...sanitizedState, + connections: { + ...state.connections, + devices: devices.map(device => { + return { + ...device.toJSON(), + logs: '<>', + }; + }), + }, + }; + } + if (state.connections.selectedDevice) { + const {selectedDevice} = state.connections; + sanitizedState = { + ...sanitizedState, + connections: { + ...sanitizedState.connections, + selectedDevice: { + ...selectedDevice.toJSON(), + logs: '<>', + }, + }, + }; + } + } + return sanitizedState; +};