Make sure the same client doesn't end up twice in the device list
Summary: Noticed in a support post that uninitialised devices could end up multiple times in the connecting list. Reviewed By: timur-valiev Differential Revision: D30957447 fbshipit-source-id: 11a2e3a9c52083245e66ebfb1899c00aeae6eb7e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
94a7b4360d
commit
8e899a90a4
@@ -25,6 +25,7 @@ import type {RegisterPluginAction} from './plugins';
|
||||
import MetroDevice from '../server/devices/metro/MetroDevice';
|
||||
import {Logger} from 'flipper-plugin';
|
||||
import {FlipperServer} from '../server/FlipperServer';
|
||||
import {shallowEqual} from 'react-redux';
|
||||
|
||||
export type StaticViewProps = {logger: Logger};
|
||||
|
||||
@@ -393,7 +394,12 @@ export default (state: State = INITAL_STATE, action: Actions): State => {
|
||||
const {payload} = action;
|
||||
return {
|
||||
...state,
|
||||
uninitializedClients: [...state.uninitializedClients, payload],
|
||||
uninitializedClients: [
|
||||
...state.uninitializedClients.filter(
|
||||
(existing) => !shallowEqual(existing, payload),
|
||||
),
|
||||
payload,
|
||||
],
|
||||
};
|
||||
}
|
||||
case 'REGISTER_PLUGINS': {
|
||||
|
||||
Reference in New Issue
Block a user