Skip to content

Commit

Permalink
feat: Support both globals and userGlobals
Browse files Browse the repository at this point in the history
  • Loading branch information
Romainpetit committed Sep 26, 2024
1 parent 17754a3 commit 5cd8fe5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ type windowWithSbGlobals = typeof window & {
export function getGlobals() {
const preview = (window as windowWithSbGlobals).__STORYBOOK_PREVIEW__

const { initialGlobals } = preview.storyStoreValue.userGlobals
const { initialGlobals } =
preview.storyStoreValue.globals ?? preview.storyStoreValue.userGlobals

return initialGlobals[PARAM_KEY]
}

0 comments on commit 5cd8fe5

Please sign in to comment.