diff --git a/code/core/src/manager/container/Panel.tsx b/code/core/src/manager/container/Panel.tsx index f8cc2877cef0..7bb36246e931 100644 --- a/code/core/src/manager/container/Panel.tsx +++ b/code/core/src/manager/container/Panel.tsx @@ -1,5 +1,5 @@ import type { FC } from 'react'; -import React from 'react'; +import React, { useCallback } from 'react'; import { Addon_TypesEnum } from '@storybook/core/types'; @@ -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),