-
-
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
[Addon: Knobs] - Performance Bug - Component within the iframe is being re-rendered upon each change of a knob - V4 and V5 #5376
Comments
I have had this same problem; it is not even a problem with the size of the component being rendered, but rather how knob settings force a re-rendering of the displayed component Iframe on change. what's CodeByAlex suggested:
Seems a good solution to the problem if implemented, or just allow changes to be submitted once editing of the knobs is done, and then on submit re-render the component Iframe; as an alternative to interpolating the binded data, on change, to the component Iframe for re rendering. The functionality of seeing the changes to the knobs on change is great for smaller components, storybook presentation and for end users who are none developers to be able to edit (it more accessible) but the larger the component the greater the need to have control of the component Iframe re-rendering, for performance, for efficiency during development and for quicker prototyping. My problem has been with storybook v4 and above, on angular as well.
I hope a fix is implemented for this. |
@igor-dv , have you been seeing this performance issue. I believe that I read that you were one of the Angular cli maintainers. |
@CodeByAlex is this addressed by #5753 ? I'm releasing that now in rc.7 |
@shilman it may be, once released, I’ll check and comment below |
@shilman the build failed and it looks like its because: WARN => Failed to get angular-cli webpack config. Nothing changed on my end but it now looks like the project cant resolve the different parts of the monorepo. May have to raise an issue. |
@shilman @igor-dv I was able to install v7 for all projects other than @storybook/angular. I noticed the knobs change referenced in #5753 was in the code as seen in the browser console below: However, I am still seeing the issue described above. On every keystroke the component is being initialized and destroyed. For simple components this isnt an issue but for more complex ones or components that require a lot of painting, it is significant. Ill take this issue on and put out a PR |
Crikey!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-alpha.1 containing PR #5811 that references this issue. Upgrade today to try it out! Because it's a pre-release you can find it on the Closing this issue. Please re-open if you think there's still more to do. |
Olé!! I just released https://github.com/storybooks/storybook/releases/tag/v5.0.1 containing PR #5811 that references this issue. Upgrade today to try it out! |
Describe the bug
The component within the iframe is being re-rendered upon each change of a knob. This is a large performance issue seen especially when using knobs with large components that include other components. The visual issue is that a lag is introduced because the rendering is slower than the changes being made to the knobs by the user.
See comments below for more information: #4740 (comment)
#4740 (comment)
To Reproduce
Steps to reproduce the behavior:
Include the knobs addon. Create a component with storybook configuration and change a knob quickly when viewing it in the iframe. This can be seen in the angular cli example.
Expected behavior
I expect the component to not get rerendered until after the user has finished typing or changing the knob. Even better would be if the inputs/props were the only modification on the component rather than the entire component being re-rendered. Debouncing might be a good option here for the former solution.
Screenshots
the gif below shows the lag that is introduced because the rendering is slower than the change being made
https://user-images.githubusercontent.com/1235821/48129367-96035d80-e289-11e8-848b-8523053c3450.gif
See gif of the issue here: #4740
System:
Additional context
I have tried to use the timestamp functionality but that does not seem to solve the issue.
Potential solution for knobChanged function:
The text was updated successfully, but these errors were encountered: