From 8e899a90a468e146184cec9021f70fd5b6751073 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Wed, 15 Sep 2021 14:44:53 -0700 Subject: [PATCH] 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 --- desktop/app/src/reducers/connections.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/desktop/app/src/reducers/connections.tsx b/desktop/app/src/reducers/connections.tsx index 20549e6c3..5b827f081 100644 --- a/desktop/app/src/reducers/connections.tsx +++ b/desktop/app/src/reducers/connections.tsx @@ -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': {