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 authored Nov 6, 2019
2 parents c14f93d + 4975a90 commit 4233f3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/core/src/client/preview/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,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 @@ -226,7 +228,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

1 comment on commit 4233f3e

@vercel
Copy link

@vercel vercel bot commented on 4233f3e Nov 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.