Files
flipper/desktop/app/src/utils/reduxDevToolsConfig.tsx
Michel Weststrate 7cc55daf34 Stop storing device logs on the device object and in the plugin
Summary:
Logs were stored hardcoded on the Device object first, this diff makes it normal plugin state.

This makes sure that we can use the same abstractions as in all plugins that store large data sets, and that we can leverage the upcoming DataSource abstraction.

Reviewed By: nikoant

Differential Revision: D26127243

fbshipit-source-id: 7c386a615fa7989f35ba0df5b7c1d218d37b57a2
2021-02-01 11:43:30 -08:00

33 lines
825 B
TypeScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {State} from '../reducers/index';
import {DeviceExport} from '../devices/BaseDevice';
export const stateSanitizer = (state: State) => {
if (state.connections && state.connections.devices) {
const {devices} = state.connections;
const {selectedDevice} = state.connections;
return {
...state,
connections: {
...state.connections,
devices: devices.map<DeviceExport>((device) => {
return device.toJSON() as any;
}),
selectedDevice: selectedDevice
? (selectedDevice.toJSON() as any)
: null,
},
};
}
return state;
};