Skip to content

Commit

Permalink
Merge branch 'next' into chore/build-packages-script
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen authored Apr 8, 2020
2 parents b8b1839 + 465c4cc commit 4a3d161
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/marko/src/client/preview/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { logger } from '@storybook/client-logger';
const rootEl = document.getElementById('root');
let activeComponent = null; // currently loaded marko component.
let activeTemplate = null; // template for the currently loaded component.
let activeStoryFn = null; // used to determine if we've switched stories.

export default function renderMain({
storyFn,
Expand All @@ -16,7 +17,9 @@ export default function renderMain({
parameters,
// forceRender,
}) {
const isSameStory = activeStoryFn === storyFn;
const config = storyFn();
activeStoryFn = storyFn;

if (!config || !(config.appendTo || config.component || parameters.component)) {
showError({
Expand All @@ -43,7 +46,7 @@ export default function renderMain({
} else {
const template = config.component || parameters.component;

if (activeTemplate === template) {
if (isSameStory && activeTemplate === template) {
// When rendering the same template with new input, we reuse the same instance.
activeComponent.input = config.input;
activeComponent.update();
Expand Down

0 comments on commit 4a3d161

Please sign in to comment.