From e8dd7ffcc02b4bcff05671a601d3244a391e9469 Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Thu, 6 Jan 2022 08:14:51 -0800 Subject: [PATCH] Adresses an issue with menu mutation Summary: A Logview issue was raised for the following error: Cannot assign to read only property '0' of object '[object Array]'. Analysis: Currently, the menuEntries are stored by reference in the reducer, and made read only to protect it against accidental writes. Tha's probably why the '0' assignment fails, and the fix is that the reducer should only get a defensive copy as config about the current menu entries to show. Reviewed By: mweststrate Differential Revision: D33454514 fbshipit-source-id: 2faf3036eb6ae4fbe9a8d0253fde27cf389d3e4c --- desktop/flipper-ui-core/src/reducers/connections.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/flipper-ui-core/src/reducers/connections.tsx b/desktop/flipper-ui-core/src/reducers/connections.tsx index 49033d9b6..1221d8302 100644 --- a/desktop/flipper-ui-core/src/reducers/connections.tsx +++ b/desktop/flipper-ui-core/src/reducers/connections.tsx @@ -473,7 +473,7 @@ export const selectPlugin = (payload: { export const setMenuEntries = (menuEntries: NormalizedMenuEntry[]): Action => ({ type: 'SET_MENU_ENTRIES', - payload: menuEntries, + payload: menuEntries.slice(), }); export const selectClient = (clientId: string): Action => ({