-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vue: After upgrading to V7 controls are not interactable #22227
Comments
@shilman thank you for giving more context, I upgraded to latest As I mentioned I am using |
Thanks for testing this out. I know there is work going on in both vue/vue3 reactivity, so I'm sorry things are in a state of flux right now. Hopefully @kasperpeulen can respond here when things are sorted out. |
I think we put all our effort on making Vue3 more reactive, but we haven't done really anything on Vue2. |
We have had this issue as well in both V6 and V7. Currently we are using the I do seem to have found a workaround for the issue though. For creating stories I have a helper function that among other things registers a reference to the Something along the lines of this:
Hope this helps someone dealing with the same issue (: |
Hi! is its possible to make same using decorator? it will allow to apply this globally |
This also happened to any Not Working
Working
|
@chakAs3 Do you think this would be easy to fix for vue2? |
So then we would drop support for Vue <2.7. |
I experience the same issue, using vue3 & @storybook/vue3
I see these errors sometimes when I change controls:
or this warning:
I have to manually click 'Remount component' on every change in the controls. |
@mokone91, facing this issue, given the @GrtDev solution, I did not manage to make it a decorator unfortunately because I did not manage to hook in the decorator’s Yet, based on that idea, I use a wrapper to author stories: import { getCurrentInstance } from 'vue';
import type { StoryFn } from '@storybook/vue';
import type { ComponentOptions } from 'vue';
export function defineStory<ArgsT>(storyFn: StoryFn<ArgsT>): StoryFn<ArgsT> {
type ComponentInstance = Vue & { args: ArgsT };
let storyComponent: ComponentOptions<Vue> | null = null;
let currentInstance: ComponentInstance | null = null;
const wrappedStory: StoryFn<ArgsT> = (storyArgs, storyContext) => {
if (storyComponent && currentInstance) {
currentInstance.args = storyArgs;
currentInstance.$forceUpdate();
}
storyComponent = (storyFn(storyArgs, storyContext) ??
{}) as ComponentOptions<Vue>;
const originalSetup = storyComponent.setup;
storyComponent.setup = function(setupProps, setupContext) {
currentInstance = getCurrentInstance()?.proxy as ComponentInstance;
return originalSetup?.(setupProps, setupContext);
};
return storyComponent;
};
return wrappedStory;
} which is used very nicely like this: const Template = defineStory<LogoProps>(args => ({
components: { Logo },
setup: () => ({ args }),
template: '<Logo v-bind="args" />',
}));
export const Light = Template.bind({});
Light.args = {
variant: 'light'
};
export const Dark = Template.bind({});
Dark.args = {
variant: 'dark'
}; I have to mention @GrtDev, using this wrapper solution was breaking the reactivity in stories themselves (here in the example when switching between "Light" and "Dark" story nothing happened) because the early return
was preventing to use properly any newly created instances. So in my implementation I don't have this early return. |
is there anything new with this issue ? am I suppose to refactor all my stories to use the suggested workarounds? |
I don't think it is likely that we will fix this as we have deprecated support for Vue2 in storybook and the vue2 renderer package won't be part of v8. |
As already mentioned, Vue 2 support will be discontinued in Storybook 8, which is scheduled for release in the coming weeks. This decision was made to streamline our development process and focus on supporting the latest technologies. Support for Vue 2 in Storybook 7To ensure a smooth transition, we will continue to provide security patches and highly upvoted bug fixes for Storybook 7. However, we strongly recommend migrating to Vue 3 or a later version as soon as possible to take advantage of the latest features and improvements. I am closing this ticket as not planned. |
@valentinpalkovic this issue happens to me using the latest vue3 & storybook versions. it started after I migrated from storybook 6 to 7, and now in 8, it's sill like this... I have tried double-checking every configuration. should I open a new bug ? |
Yes! Please create a new bug report. |
opened #26876 |
Describe the bug
After migrated to Storybook V7, now Controls do not trigger Story re-render.
I have simple component
MyButton.vue
MyButton.stories.js
Under individual stories Controls it doesn't re-render story after I changed arg value.
But if I switch to Docs, it is re-rendered with new args
And if I change value again, it doesn't get updated.
It was working with latest v6.
To Reproduce
vue-demi
+vue-vite
Controls
to play with component - it doesn't workSystem
Additional context
No response
The text was updated successfully, but these errors were encountered: