Skip to content
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

Bug: as per React: unmount callbacks should be called before removing DOM #32

Closed
Havunen opened this issue Jan 20, 2018 · 5 comments
Closed

Comments

@Havunen
Copy link

Havunen commented Jan 20, 2018

unmount callbacks should be called before removing DOM.
See https://jsfiddle.net/Luotcj1f/ for React behavior.
at least this line in wrong:
https://github.com/NervJS/nerv/blob/master/packages/nerv/src/vdom/patch.ts#L95-L96

Didn't check any other places.

@Havunen Havunen changed the title as per React: unmount should run before removing DOM as per React: unmount callbacks should be called before removing DOM Jan 20, 2018
@Havunen Havunen changed the title as per React: unmount callbacks should be called before removing DOM Bug: as per React: unmount callbacks should be called before removing DOM Jan 20, 2018
@yuche
Copy link
Contributor

yuche commented Jan 20, 2018

See https://codesandbox.io/s/j2wym3n6w5 for Nerv behavior.
I guess Nerv can still access to the dom on componentWillUnmount function.

But still, there is bug in Top level API render, Nerv can just return null when first argument is null.
Thanks for point that out.

@Havunen
Copy link
Author

Havunen commented Jan 20, 2018

My point was that when doing keyed algo you remove DOM first, then call the callbacks. Ok I create full reproduce wait a sec.

@Havunen
Copy link
Author

Havunen commented Jan 20, 2018

https://codesandbox.io/s/3x29y3040m
edit: there is something else too ... I create another fiddle

another where it fails: https://codesandbox.io/s/5xpp5q4lyn

@yuche
Copy link
Contributor

yuche commented Jan 20, 2018

Thanks for the reproduce. It's a really nice that you can help us on the weekend. ❤️

@yuche yuche closed this as completed in eef6297 Jan 22, 2018
@yuche
Copy link
Contributor

yuche commented Jan 22, 2018

There is serval tests for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants