From 09c793b2c982c761f7f5dcf6ac9ea3ab14bc9eb1 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Sun, 24 Sep 2023 19:32:23 +0200 Subject: [PATCH] add missing dependency in useEffect hook this was causing browsers to crash --- code/lib/manager-api/src/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/lib/manager-api/src/index.tsx b/code/lib/manager-api/src/index.tsx index 3b0a21bdcb94..951dc494a93a 100644 --- a/code/lib/manager-api/src/index.tsx +++ b/code/lib/manager-api/src/index.tsx @@ -397,7 +397,6 @@ export function useSharedState(stateId: string, defaultState?: S) { existingState, STORYBOOK_ADDON_STATE[stateId] ? STORYBOOK_ADDON_STATE[stateId] : defaultState ); - let quicksync = false; if (state === defaultState && defaultState !== undefined) { @@ -409,7 +408,7 @@ export function useSharedState(stateId: string, defaultState?: S) { if (quicksync) { api.setAddonState(stateId, defaultState); } - }); + }, [quicksync]); const setState = async (s: S | API_StateMerger, options?: Options) => { const result = await api.setAddonState(stateId, s, options);