mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
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:
commit
c2d2ca1b5a
@ -41,7 +41,7 @@ function prepare(rawStory: StoryFnVueReturnType, innerStory?: ConcreteComponent)
|
||||
|
||||
return {
|
||||
render() {
|
||||
return h(story, this.$root.storyArgs);
|
||||
return h(story);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user