-
Notifications
You must be signed in to change notification settings - Fork 267
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
unkeyed children diffing error causes component lifecycle event to fire unexpectedly #40
Comments
yaodingyd
changed the title
unkeyed children diffing error cause component lifecycle event to fire unexpectedly
Feb 6, 2018
Thanks for reporting this issue. nerv/packages/nerv/__tests__/patch.spec.js Lines 129 to 206 in 218563a
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test case
Click two buttons
Expected: console log should only has "updated"
Results: Console log gets "mounted" and "unmounted".
Basically, if parent component B has unkeyed children, and there are children add/remove before child component A, even though the changed child is not a component A, A still gets mounted/unmounted, because unkeyed children are diffed in sequential order.
In the Inferno way, it has normalized VNode so if key is not set, it might use children order and
null
is considered a child too, so child component always has the same normalized key, thus gets the correct diffing results.The text was updated successfully, but these errors were encountered: