-
-
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
Don't change rootElement when received node is the same #4822
Conversation
Can you maybe share a usecase ? I can think of knobs changes, but for this, we have a |
Codecov Report
@@ Coverage Diff @@
## next #4822 +/- ##
==========================================
- Coverage 35.55% 35.49% -0.06%
==========================================
Files 560 560
Lines 6827 6820 -7
Branches 915 914 -1
==========================================
- Hits 2427 2421 -6
Misses 3920 3920
+ Partials 480 479 -1
Continue to review full report at Codecov.
|
Hey @igor-dv. The case you refer is exactly in the case of using knobs. When changing a knob, it causes the whole content of root to be replaced, so no transitions happen since there was no class "added". I understand what you mean regarding Tell me if I've understood anything wrong and we'll try to elaborate more. |
Maybe |
Yeah, from your explanation it seems |
4ab16e7
to
5a33ea0
Compare
Issue:
storybook-html's render is always rewriting the root element's content even when it's not a different component. This appeared to be a problem for dynamic class changes (as in changing a prop in a AngularJS component) as it is removing the dom node and adding it again which kills stuff like animations (since from the browser's perspective this is not a change in the class attribute and it is a new node).
Props to @svipatov for finding the issue and help developing this PR.
What I did
Checked the reference of the received DOM node, if it is the same then the node was already mutated and there is no need to rewrite the root element.
How to test
It could be, but I did not find any test for the changed file (I can add it if it's wanted)
No
No
If your answer is yes to any of these, please make sure to include it in your PR.