plugin reselection
Summary: When relaunching Flipper/refreshing it while developing, where was a case, where the App Client connected, before the device was registered in Flipper. In this case, we didn't select the previously selected plugin Reviewed By: jknoxville Differential Revision: D9359779 fbshipit-source-id: 9c6f8e6bf65a46dc84c9781242b23df0ed539810
This commit is contained in:
committed by
Facebook Github Bot
parent
cded1ceead
commit
f4822143bd
@@ -102,17 +102,27 @@ export default function reducer(
|
|||||||
case 'REGISTER_DEVICE': {
|
case 'REGISTER_DEVICE': {
|
||||||
const {payload} = action;
|
const {payload} = action;
|
||||||
const devices = state.devices.concat(payload);
|
const devices = state.devices.concat(payload);
|
||||||
let {selectedDevice} = state;
|
let {selectedDevice, selectedPlugin} = state;
|
||||||
let selection = {};
|
|
||||||
|
// select the default plugin
|
||||||
|
let selection = {
|
||||||
|
selectedApp: null,
|
||||||
|
selectedPlugin: DEFAULT_PLUGIN,
|
||||||
|
};
|
||||||
|
|
||||||
if (!selectedDevice) {
|
if (!selectedDevice) {
|
||||||
selectedDevice = payload;
|
selectedDevice = payload;
|
||||||
selection = {
|
if (selectedPlugin) {
|
||||||
selectedApp: null,
|
// We already had a plugin selected, but no device. This is happening
|
||||||
selectedPlugin: DEFAULT_PLUGIN,
|
// when the Client connected before the Device.
|
||||||
};
|
selection = {};
|
||||||
|
}
|
||||||
} else if (payload.title === state.userPreferredDevice) {
|
} else if (payload.title === state.userPreferredDevice) {
|
||||||
selectedDevice = payload;
|
selectedDevice = payload;
|
||||||
|
} else {
|
||||||
|
// We didn't select the newly connected device, so we don't want to
|
||||||
|
// change the plugin.
|
||||||
|
selection = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user