-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Component with slot rerenders even if the slot or component data has not changed #6898
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
Comments
Well, it has to re-render to see if anything changed, or not. I understand that you may think "we could simply diff the new vnodes in the parent, and not pass them to the child when there's no diff" Unfortunately that doesn't take into account all possible edge cases, so there's no easy way around that in the current architecture. Also, assuming we could go this route, this would have a performance trade-off: As we would still have to diff the vnodes in the child, we diff the same vnodes two times now - which means that for components that are light themselves and receive large slot contents, the performance would worsen. And I think that large slot trees are pretty common, as they are even nested quite often. Concerning your situation: If you are encountering performance issues, there are other options to optimize, most useful here are probably:
|
Hm, so I just took a look at the issues you mentioned this one in. Indeed sub-optimal. @yyx990803 Can you share some insight? |
There is already plan to improve and is tracked in #6351 |
Thank you! |
Wow, that's a weird feeling seeing my own answer in #6351 and seeing how it's almost verbatim the same I gave here, but I have no recollection of that other reply :D Glad that this will be improved though. |
Turns out john came across the same thing a few months ago: #5155 |
I haven't looked deeply at the whole update/render pipeline, so speaking conceptually, I'm curious why dependency changes alone can't determine if a component/slot should re-render? |
Version
2.5.2
Reproduction link
https://codepen.io/anon/pen/NaVVpW?editors=1011
Steps to reproduce
Type something in the input
What is expected?
render
method of the Test component shouldn't be calledWhat is actually happening?
render
method of the Test component is calledIt is an serious performance issue if the component is complicated, it's rerendered even if nothing changes
The text was updated successfully, but these errors were encountered: