-
-
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
Svelte: Fix docs rendering #19705
Svelte: Fix docs rendering #19705
Conversation
Umm.... we do 🤷 storybook/code/lib/types/src/modules/store.ts Lines 38 to 42 in 816930c
storybook/code/lib/preview-web/src/render/StoryRender.ts Lines 218 to 219 in 816930c
storybook/code/renderers/react/src/render.tsx Line 163 in 816930c
(Sorry those code references are from this branch #19623 where I renamed |
Good to know! |
I've reworked the implementation to
2 should probably have some tests, but I think we should do that in a follow-up PR to unblock #19659 now. The tests would need a stateful component which none of our default components are - I think we should introduce that either way. I'm pretty sure I can do the same remount fix for the Vue3 renderer in combination with the workarounds mentioned in vuejs/core#4874. |
Nice job @JReinhold! Actually we already have a test for 2 -- it is just disabled for Svelte ATM:
As you can see I used focus as a stand-in for state ;) We could have also used the form component and filled it in a little bit. |
CI is blocking me on this. However I can't generate new repros for the repros repository, because CI is failing with ENOSPC: no space left on device. 🫠 |
my tests keeps failing because my changes to repros get overwritten by the scheduled repro generator, and thus the sandboxes wont update. I think this is ready to merge when it has been reviewed @tmeasday . the tests passes locally, and the failing tests are exactly what I'd expect to see based on the changes I've made here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Svelte part looks great, maybe we should drop the vue part until we take another look at it?
Fine by me, this is a very minor fix anyway, that is incorporated in #19737 . |
Issue: #19205
This PR fixes a number of issues:
parameters.docs.autoplay
#19659A memory leak in the Vue3 renderer that uses a similar architecture.Previously the Svelte renderer would destroy any previous component rendered whenever a new component was to be rendered. In docs with inline rendering this would cause each story to destroy each other immediately, leaving the last one remaining.
This PR (inspired by the vue3 renderer) instead keeps a map of all the parent DOM elements in use and only destroys them if the component to be rendered has a matching DOM element.