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

Alternate fix for "Fix a crash in Suspense with findDOMNode" #15312

Merged
merged 2 commits into from
Apr 3, 2019

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Apr 3, 2019

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.

@bvaughn
Copy link
Contributor

bvaughn commented Apr 3, 2019

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

@sizebot
Copy link

sizebot commented Apr 3, 2019

Fails
🚫

node` failed.

Log

Error:  { 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

Copy link
Collaborator

@sebmarkbage sebmarkbage left a 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.

@acdlite
Copy link
Collaborator Author

acdlite commented Apr 3, 2019

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;
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

@acdlite
Copy link
Collaborator Author

acdlite commented Apr 3, 2019

I'll squash my commits (but leave @gaearon's separate) and land via command line so @gaearon also gets credit

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.
@acdlite acdlite merged commit 43b1f74 into facebook:master Apr 3, 2019
@bvaughn
Copy link
Contributor

bvaughn commented Apr 4, 2019

Thanks folks!

Synced to DevTools via bvaughn/react-devtools-experimental@7fbdfd9

@gaearon gaearon mentioned this pull request Jul 30, 2019
This was referenced Mar 10, 2020
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.

6 participants