-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
fix(hmr): fix render error in change static nodes (#6978) #7114
Conversation
❌ Deploy Preview for vuejs-coverage failed.
|
8a16da6
to
97104ff
Compare
97104ff
to
0a34d85
Compare
hey! any update on getting this change rolled out? 😅 it's still a pain to deal with this bug, and the fix looks good to go 😸 |
It seems like the core team is waiting for the release of Vapor mode. 🙄 |
if (__DEV__ && isArray(children)) { | ||
children = [...children] | ||
} |
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.
Not sure if we should do always this, I wonder if we should change children
to be cloned: children = (children as VNode[]).map(deepCloneVNode)
I also wonder if the condition is correct, that way we are unnecessarily adding a new array every time, from this example alone we could do something like:
if (
__DEV__ &&
(patchFlag === PatchFlags.HOISTED ||
patchFlag === PatchFlags.UNKEYED_FRAGMENT) &&
isArray(children)
)
But not certain if that will fix every case 🤔
Thanks a lot for the PR, it correctly identifies the cause of the problem, but I think a more ideal fix would be to only clone the children array when we know for sure it's hoisted. Unfortunately there isn't a really easy check to do this from runtime, so I implemented a compile-time fix where the |
fix #6978
fix #7138