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

[Fiber] Throw when attempting to unmount at an invalid node #8688

Merged
merged 2 commits into from
Jan 6, 2017

Conversation

aweary
Copy link
Contributor

@aweary aweary commented Jan 4, 2017

Saw this failing test, figured it would be an easy fix 😄

@aweary aweary force-pushed the fiber-warn-invalid-node-unmount branch from 53133e1 to deaf3e5 Compare January 4, 2017 22:02
invariant(
isValidContainer(container),
'unmountComponentAtNode(...): Target container is not a DOM element.'
);t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra t on the end ^

Isn't this unnecessary though?

unmountComponentAtNode calls renderSubtreeIntoContainer which calls validateContainer which throws- just with a slightly different error message (eg "Target container is not a DOM element.")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a better fix would just be to update the ReactMount-test to expect the slightly different error message based on ReactDOMFeatureFlags.useFiber?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bvaughn but renderSubtreeIntoContainer is only called if container._reactRootContainer exists, so it wouldn't actually throw, it would just be a no-op.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@acdlite acdlite merged commit 8095eba into facebook:master Jan 6, 2017
@acdlite
Copy link
Collaborator

acdlite commented Jan 6, 2017

Thanks!

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

Successfully merging this pull request may close these issues.

5 participants