-
Notifications
You must be signed in to change notification settings - Fork 49.2k
[Fiber] Fix TestUtils edge cases #8257
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
Conversation
while (root.return) { | ||
root = root.return; | ||
} | ||
var isRootCurrent = root.tag === HostContainer && root.stateNode.current === root; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is a good way to tell that we're in a current tree. Any pitfalls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm facing the same problem in the PR I'm working on.
👍 but let's decide (or clarify) the established way to determine whether a fiber is current |
Hmm, I don't think following the |
What's the right way to get the current version of a given Fiber? I tried looking at |
I think |
So maybe function getCurrentFiber(fiber : Fiber): Fiber | null {
if (isFiberMounted(fiber)) {
return fiber;
} else if (fiber.alternate && isFiberMounted(fiber.alternate)) {
return fiber.alternate;
} else {
return null;
}
} |
I tried this but |
Huh interesting. Maybe what you did is correct then. Can't say I fully understand, though. Could you put your solution into |
Actually I think I understand now. Your solution is correct 👍 |
Haha now I'm not sure if it's correct. 😄 |
I think #7344 (comment) doesn't apply because I don't care if either node on the path is current or not. I only care about the root node for which I can find it out. I also care that if a node's root is current, it follows that the node is current. Does this assumption always hold? |
I think it does because the |
* Add more reactComponentExpect tests * Implement reactComponentExpect in Fiber
359906f
to
3bcc173
Compare
OK, let's do it and if it's broken then add a breaking test. |
* Add more reactComponentExpect tests * Implement reactComponentExpect in Fiber
The rest of TestUtils failures are now all Simulate related.