-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Alternate fix for "Fix a crash in Suspense with findDOMNode" #15312
Conversation
Note to self: Assuming we land this, make sure we sync it to the new DevTools package too https://github.com/bvaughn/react-devtools-experimental/blob/07bf8e53c1e6fbf6503bebc170622ab161cf3b8f/src/backend/renderer.js#L1105-L1106 |
LogError: { FetchError: invalid json response body at http://react.zpao.com/builds/master/_commits/43b1f74c88d986c88623412be7b1d65a6e271779/results.json reason: Unexpected token < in JSON at position 0
at /home/circleci/project/node_modules/node-fetch/lib/body.js:48:31
at process._tickCallback (internal/process/next_tick.js:68:7)
name: 'FetchError',
message:
'invalid json response body at http://react.zpao.com/builds/master/_commits/43b1f74c88d986c88623412be7b1d65a6e271779/results.json reason: Unexpected token < in JSON at position 0',
type: 'invalid-json' }
Generated by 🚫 dangerJS |
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.
This only deals with one of the paths hitting this case.
If we're traversing backwards in the inverse case, then we'll skip past the extra fragment on one of the nodes. It seems like something else can go wrong in that scenario.
Oops forgot to run Flow |
@@ -117,11 +117,19 @@ export function findCurrentFiberUsingSlowPath(fiber: Fiber): Fiber | null { | |||
let b = alternate; | |||
while (true) { | |||
let parentA = a.return; |
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.
What if parentA here is a Suspense boundary with no fragment and its alternate is a Suspense boundary with a fragment?
In that case the children won't be representing the same thing. However, they also will never be equal so maybe it doesn't matter?
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.
That was my thinking, at least
This doesn't rely on checking the tag. When the alternate of a parent is missing, it assumes it's a fragment indirection and moves onto the next parent fiber.
982252d
to
43b1f74
Compare
Thanks folks! Synced to DevTools via bvaughn/react-devtools-experimental@7fbdfd9 |
This doesn't rely on checking the tag. When the alternate of a parent is missing, it assumes it's a fragment indirection and moves onto the next parent fiber.
I based my commit on top of @gaearon's PR #15195.