mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
Hide addon panel while loading.
This commit is contained in:
parent
effba9e367
commit
fa5c843aa9
@ -60,10 +60,9 @@ const createCanvas = (id: string, baseUrl = 'iframe.html', withLoader = true): A
|
|||||||
...defaultWrappers,
|
...defaultWrappers,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const isLoading = !!(
|
const isLoading = story
|
||||||
(!story && !(storiesFailed || storiesConfigured)) ||
|
? !!refs[refId] && !refs[refId].ready
|
||||||
(story && refId && refs[refId] && !refs[refId].ready)
|
: !storiesFailed && !storiesConfigured;
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ZoomConsumer>
|
<ZoomConsumer>
|
||||||
|
@ -46,13 +46,16 @@ export const Root: FunctionComponent<RootProps> = ({ provider, history }) => (
|
|||||||
{({ state, api }: Combo) => {
|
{({ state, api }: Combo) => {
|
||||||
const panelCount = Object.keys(api.getPanels()).length;
|
const panelCount = Object.keys(api.getPanels()).length;
|
||||||
const story = api.getData(state.storyId, state.refId);
|
const story = api.getData(state.storyId, state.refId);
|
||||||
|
const isLoading = story
|
||||||
|
? !!state.refs[state.refId] && !state.refs[state.refId].ready
|
||||||
|
: !state.storiesFailed && !state.storiesConfigured;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemeProvider key="theme.provider" theme={ensureTheme(state.theme)}>
|
<ThemeProvider key="theme.provider" theme={ensureTheme(state.theme)}>
|
||||||
<App
|
<App
|
||||||
key="app"
|
key="app"
|
||||||
viewMode={state.viewMode}
|
viewMode={state.viewMode}
|
||||||
layout={state.layout}
|
layout={isLoading ? { ...state.layout, showPanel: false } : state.layout}
|
||||||
panelCount={panelCount}
|
panelCount={panelCount}
|
||||||
docsOnly={story && story.parameters && story.parameters.docsOnly}
|
docsOnly={story && story.parameters && story.parameters.docsOnly}
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user