Skip to content

Commit

Permalink
Merge pull request #24291 from storybookjs/yann/fix-infinite-effect-call
Browse files Browse the repository at this point in the history
UI: Fix infinite hook call causing browsers to freeze
  • Loading branch information
shilman committed Sep 24, 2023
2 parents cf3fdaf + 09c793b commit bf3c377
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions code/lib/manager-api/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ export function useSharedState<S>(stateId: string, defaultState?: S) {
existingState,
STORYBOOK_ADDON_STATE[stateId] ? STORYBOOK_ADDON_STATE[stateId] : defaultState
);

let quicksync = false;

if (state === defaultState && defaultState !== undefined) {
Expand All @@ -409,7 +408,7 @@ export function useSharedState<S>(stateId: string, defaultState?: S) {
if (quicksync) {
api.setAddonState<S>(stateId, defaultState);
}
});
}, [quicksync]);

const setState = async (s: S | API_StateMerger<S>, options?: Options) => {
const result = await api.setAddonState<S>(stateId, s, options);
Expand Down

0 comments on commit bf3c377

Please sign in to comment.