-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 toTree() handling mismatches #1512
Comments
I've probably exacerbated 2 & 3 with #1513 as well. All 4 branches are supposed to the same logic, I think that would be better signaled by stacked |
@gaearon moving the conversion in #1399 here
I don't remember the context around why
Exposing This might be a good opportunity for both teams to collaborate on an RFC for a better low-level testing interface. I'm not sure either team has the time/resources to commit though, which is partially why previous attempts have dropped off. |
it's be really nice to have Enzyme use |
Sorry for deleting the template, there are a few very specific problems I saw in the source.
I'm not sure how I feel about Import findCurrentFiberUsingSlowPath from react-reconciler/reflection #1399. It gives a false sense of security but in practice can still break in patch versions. I explain the reasoning in a comment there—basically, it works by accident, and if
react-dom
internal logic changes you'd have to fork it again anyway because you'd need to support multiple versions.It seems like this call won't handle a fragment inside a root correctly. It will just skip over any but the first item. I'm not sure Enzyme API allows rendering an array or a
<Fragment>
as a root node but React does. (Note React'stoTree()
is also broken in this way—but I fixed it in Fix fragment and portal handling in toTree() facebook/react#12154.)If the above is right, I suspect that this call might also not work with fragments. It is totally legitimate to put a fragment inside a portal.
I haven't had time to verify these in detail because I'm in the middle of fixing React
toTree()
bugs myself. But I thought it might be helpful to report for further investigation.The text was updated successfully, but these errors were encountered: