Files
flipper/src/utils/reduxDevToolsConfig.js
Pritesh Nandgaonkar 47a55b0f26 Migrate BaseDevice from js to tsx
Summary: As per the title

Reviewed By: passy

Differential Revision: D16687261

fbshipit-source-id: a9d85424fb0a08fada7edd0355c356907518d366
2019-08-09 06:56:54 -07:00

36 lines
907 B
JavaScript

/**
* 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
*/
import {State} from '../reducers/index.tsx';
import type {DeviceExport} from '../devices/BaseDevice.tsx';
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(),
logs: [],
};
}),
selectedDevice: selectedDevice
? {
...selectedDevice.toJSON(),
logs: [],
}
: null,
},
};
}
return state;
};