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

react-call-return: Expected to find a host parent. #11955

Closed
rmhartog opened this issue Jan 3, 2018 · 7 comments
Closed

react-call-return: Expected to find a host parent. #11955

rmhartog opened this issue Jan 3, 2018 · 7 comments

Comments

@rmhartog
Copy link
Contributor

rmhartog commented Jan 3, 2018

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
A specific order of unmounting and remounting unstable_createReturns from react-call-return causes an invariant violation in unmountHostComponents.

Reproduce
The following sandbox example crashes with an invariant violation when both the min and cycle props are odd numbers greater than zero.

https://codesandbox.io/s/llyjz19rz7

What is the expected behavior?
The app does not crash and cycles the number of items in the list.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
react and react-dom versions 16.1 and newer, react-call-return version 0.5.0

@rmhartog
Copy link
Contributor Author

rmhartog commented Jan 5, 2018

Performing the same sequence of mounts and unmounts with react-test-renderer causes the same error, so it appears that the bug occurs in the reconciler.

@gaearon
Copy link
Collaborator

gaearon commented Jan 5, 2018

Wanna try digging into where the bug is?

@gaearon
Copy link
Collaborator

gaearon commented Jan 5, 2018

Tagging as a good issue to get into, but it's not an easy one.

@rmhartog
Copy link
Contributor Author

rmhartog commented Jan 5, 2018

Yes, I'd love to dig into it further!

@gaearon
Copy link
Collaborator

gaearon commented Jan 6, 2018

Sounds good. You'll probably want to look at BeginWork, CompleteWork, and ChildFiber, and how those handle Calls and Returns. Let me know if some aspects are confusing and I can try to explain.

@rmhartog
Copy link
Contributor Author

rmhartog commented Jan 6, 2018

It seems like a minor mistake when reconciling the children, causing duplicate deletions in some cases. Opened a pull request for the changes.

@gaearon
Copy link
Collaborator

gaearon commented Jan 7, 2018

Fixed in #11979.

There are likely more bugs with call/return. If you can try to stress-test this feature and find them, that would be great!

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

No branches or pull requests

2 participants