Skip to content

Commit

Permalink
Merge pull request #17292 from storybookjs/fix/ui/composition_docs_mode
Browse files Browse the repository at this point in the history
Core: Apply Docs mode to composed storybooks
  • Loading branch information
shilman committed Feb 4, 2022
2 parents 36f356d + 76ad114 commit 9b9ea26
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/ui/src/components/sidebar/Sidebar.tsx
Expand Up @@ -105,7 +105,24 @@ export const Sidebar: FunctionComponent<SidebarProps> = React.memo(
() => (DOCS_MODE ? collapseAllStories : collapseDocsOnlyStories)(storiesHash),
[DOCS_MODE, storiesHash]
);
const dataset = useCombination(stories, storiesConfigured, storiesFailed, refs);
const adaptedRefs = useMemo(() => {
if (DOCS_MODE) {
return Object.keys(refs).reduce((acc: Refs, cur) => {
const ref = refs[cur];
if (ref.stories) {
acc[cur] = {
...ref,
stories: collapseDocsOnlyStories(ref.stories),
};
} else {
acc[cur] = ref;
}
return acc;
}, {});
}
return refs;
}, [DOCS_MODE, refs]);
const dataset = useCombination(stories, storiesConfigured, storiesFailed, adaptedRefs);
const isLoading = !dataset.hash[DEFAULT_REF_ID].ready;
const lastViewedProps = useLastViewed(selected);

Expand Down

0 comments on commit 9b9ea26

Please sign in to comment.