Skip to content

Commit

Permalink
chore: fix storybook beta 7 bug with viewMode
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed May 17, 2020
1 parent 7262b7f commit 81cb550
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion misc/storybook-custom-docs/src/preview-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ ${pages
.join('\n')}
window.addEventListener('load', () => {
const selection =
window &&
//@ts-ignore
window.__STORYBOOK_CLIENT_API__ &&
//@ts-ignore
window.__STORYBOOK_CLIENT_API__.store().getSelection();
const viewMode = selection ? selection.viewMode : undefined;
const urlParams = new URLSearchParams(window.location.search);
const viewMode = urlParams.get('viewMode') || (selection ? selection.viewMode : undefined);
attachPages(pageConfigs, viewMode);
});
`;
Expand Down

0 comments on commit 81cb550

Please sign in to comment.