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
Svelte & vite bind:clientWidth doesn't work on 1st load #16786
Comments
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Hi, I see you mentioned vite, are you using https://github.com/eirslett/storybook-builder-vite? |
hi @IanVS yes I'm on |
We just released some fixes for svelte, would you mind trying to update to the latest release? |
Thank you this now works, I initially had some problems though, typescript wasn't working. I think I fixed this before with
in my main.js but after a bit of googling and finding this https://stackoverflow.com/questions/70681325/storybook-vite-svelte-typescript-typescript-not-being-processed-in-st I have switched to
and all is good. Thanks again @IanVS . |
Describe the bug
In this svelte repl https://svelte.dev/repl/f078cbd64eb94ecda12d854c898d5955?version=3.44.2 the width of an element is printed using Svelte's bind:clientWidth. The same component in Storybook renders '0' unless the window is resized or a HMR update happens.
To Reproduce
Note I couldn't use the reproduce script, I got the following error...
An error occurred while executing:
yarn set version berry && yarn config set enableGlobalCache true && yarn config set nodeLinker node-modules
create the following component & story in a setup as described in 'system'...
Test.svelte...
Test.stories.svelte...
Note I have created a workaround as follows...
System
Environment Info:
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
Binaries:
Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
Yarn: 1.21.1 - ~/.yarn/bin/yarn
npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm
Browsers:
Chrome: 96.0.4664.55
npmPackages:
@storybook/addon-actions: ^6.4.0-rc.5 => 6.4.0-rc.5
@storybook/addon-essentials: ^6.4.0-rc.5 => 6.4.0-rc.5
@storybook/addon-links: ^6.4.0-rc.5 => 6.4.0-rc.5
@storybook/addon-svelte-csf: ^1.1.0 => 1.1.0
@storybook/svelte: ^6.4.0-rc.5 => 6.4.0-rc.5
The text was updated successfully, but these errors were encountered: