Skip to content

Commit

Permalink
UI: Fix unmount components on Canvas/Docs tab switch (#8625)
Browse files Browse the repository at this point in the history
UI: Fix unmount components on Canvas/Docs tab switch
  • Loading branch information
shilman committed Nov 9, 2019
1 parent c4ba569 commit b430c32
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/core/src/client/preview/start.js
Expand Up @@ -200,12 +200,14 @@ export default function start(render, { decorateStory } = {}) {
case 'docs':
if (previousKind != null && (kind !== previousKind || viewMode !== previousViewMode)) {
storyStore.cleanHooksForKind(previousKind);
ReactDOM.unmountComponentAtNode(document.getElementById('docs-root'));
}
break;
case 'story':
default:
if (previousId != null && (id !== previousId || viewMode !== previousViewMode)) {
storyStore.cleanHooks(previousId);
ReactDOM.unmountComponentAtNode(document.getElementById('root'));
}
}

Expand All @@ -224,7 +226,6 @@ export default function start(render, { decorateStory } = {}) {
default: {
if (previousViewMode === 'docs') {
document.getElementById('docs-root').setAttribute('hidden', true);
ReactDOM.unmountComponentAtNode(document.getElementById('docs-root'));
document.getElementById('root').removeAttribute('hidden');
}
}
Expand Down

0 comments on commit b430c32

Please sign in to comment.