From 2adf23d1f84527c9c72b6c57890d31d7ec33326f Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Mon, 6 Jan 2025 12:36:47 +0100 Subject: [PATCH] Manager: Optimize getPanels function with memoization --- code/core/src/manager/container/Panel.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/core/src/manager/container/Panel.tsx b/code/core/src/manager/container/Panel.tsx index f8cc2877cef0..25292bd50769 100644 --- a/code/core/src/manager/container/Panel.tsx +++ b/code/core/src/manager/container/Panel.tsx @@ -16,7 +16,7 @@ const createPanelActions = memoize(1)((api) => ({ togglePosition: () => api.togglePanelPosition(), })); -const getPanels = (api: API) => { +const getPanels = memoize(1)((api: API) => { const allPanels = api.getElements(Addon_TypesEnum.PANEL); const story = api.getCurrentStoryData(); @@ -42,7 +42,7 @@ const getPanels = (api: API) => { }); return filteredPanels; -}; +}); const mapper = ({ state, api }: Combo) => ({ panels: getPanels(api),