Merge pull request #15409 from storybookjs/revert-15168-vue3-update-args-without-remount

Revert "Vue3: Update args without re-mounting component"
This commit is contained in:
Michael Shilman 2021-06-29 16:25:11 +08:00 committed by GitHub
commit c2d2ca1b5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 18 deletions

View File

@ -41,7 +41,7 @@ function prepare(rawStory: StoryFnVueReturnType, innerStory?: ConcreteComponent)
return {
render() {
return h(story, this.$root.storyArgs);
return h(story);
},
};
}

View File

@ -1,15 +1,10 @@
import dedent from 'ts-dedent';
import { createApp, h, shallowRef, ComponentPublicInstance } from 'vue';
import { Args } from '@storybook/addons';
import { RenderContext, StoryFnVueReturnType } from './types';
const activeStoryComponent = shallowRef<StoryFnVueReturnType | null>(null);
interface Root extends ComponentPublicInstance {
storyArgs?: Args;
}
let root: Root | null = null;
let root: ComponentPublicInstance | null = null;
export const storybookApp = createApp({
// If an end-user calls `unmount` on the app, we need to clear our root variable
@ -17,12 +12,6 @@ export const storybookApp = createApp({
root = null;
},
data() {
return {
storyArgs: undefined,
};
},
setup() {
return () => {
if (!activeStoryComponent.value)
@ -59,13 +48,9 @@ export default function render({
showMain();
if (!forceRender) {
activeStoryComponent.value = element;
}
activeStoryComponent.value = element;
if (!root) {
root = storybookApp.mount('#root');
}
root.storyArgs = args;
}