-
Notifications
You must be signed in to change notification settings - Fork 32
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
[Bug] Storybook 7 Controls doesn't change component within iframe unless manually trigger refresh #80
Comments
@JReinhold It looks like this is the same/similar issue that I mentioned to you on Discord where changing the controls were not updating the component when using an "in between" component like in this example. However, if I change it to follow this kind of pattern instead, changing the controls works:
|
I've created a reproduction of this issue here in this repo. Reproduction steps are in the README.md |
hey @haleksandre, any updates on this? |
This still happens with the currently latest versions of storybook (beta.46) |
I've noticed two other related issues (maybe it's actually the same issue, expressed two ways) with the way that Controls work with These are not present in the version of Storybook used in the reproduction that @haleksandre provided; I took that reproduction and upgraded the Storybook packages to the version I have in my own app, to validate that the issue I'm seeing in my app is present there as well. Both of these issues are reproducible in @haleksandre's reproduction repo if Storybook is upgraded to
|
still an issue in beta.62 |
Having the same issue in (@storybook/addon-svelte-csf: 3.0.0-next.4) |
Hello, with @storybook/sveltekit 7.0.0-rc.9 and @storybook/addon-svelte-csf: 3.0.0-next.4 controls don't work even after the page is refreshed. I noticed the control object has changed place in argTypes but this only makes the controls visible but doesn't allow usage. |
Had the same issue with controlls not refreshing the component/story after args changed. Created a PR that fixed this for me #99 Essentially, the Wrapper Component would need to react on $$props change and recreate the Story Component. No iframe refresh needed in those cases. |
It would amazing if the iframe didn't refresh as it triggers an additional and unnecessary onMount which can complicate testing. |
With the Change I'm testing, the iframe doesn't refresh. The Story-proxy is remounted which will reflect the change. This was the easiest fix for now. |
The other fix would be to wrap the args context into a writeable and make sure Template and Story components are correctly react on changes to tis Store |
IMO, it should reflect the behaviour of the component outside of an iframe. The store option seems like a good idea. |
Agree, need to look into this. We'd need stores for args and context in this case (otherwise changes to context.globals would equally be lost, which is important in case someone uses global toolbar buttons for theme switching or similar) |
I did update the PR now, using stores and also a clean context at render time. I think that's very close to vanilla svelte behaviour. 0625703 |
I also encountered this issue – where controls do not update the canvas on change. I tried @leika:s solution. It worked well, looking forward for this to get into main 👍🏽 |
Is there a reason why it's still not fixed ? does it need testing power or something ? It really is the only thing that current storybook is missing (for svelte) |
🚀 Issue was released in |
Hey! Does anyone still experience this issue? After changing the component parameters, the component is not unmounted, so if any variables inside the component rely on the attribute value, they won't be refreshed... I have prepared a minimal reproduction ( https://stackblitz.com/edit/storybook-svelte-bug?file=README.md,assets%2Fsvelte%2Fui%2Fatoms%2FButton%2FButton.svelte ). Please note that the button component has 2 parameters:
So is this how Storybook Svelte works, and is it the intended behavior? Do I need to change all the components? Or is this considered incorrect behavior? |
@miedzikd this is indeed intended behavior. In Storybook 7 we fixed a bug, where changing any arg would remount the whole component. Not only was that slow, it also made it impossible for users to test how their components react to changes to props. So now changing args will trigger props changes, not full remounts. As a workaround you can wrap your <Story name="Button" let:args>
{#key args.color}
<Button on:click={handleClick} {...args}>
Count: {count}
</Button>
{/key}
</Story> There might be edge cases where this workaround fails, I haven't tested it extensively. |
Describe the bug
Controls values doesn't reflect on the component unless clicking manually the remount button or a full page refresh with args preset in url.
Reproduction repo: https://github.com/haleksandre/storybook7-svelte
Steps to reproduce the behavior
Expected behavior
Environment
The text was updated successfully, but these errors were encountered: