Skip to content

Bugfix: nextFlushedRoot should always be set when performing work#11558

Merged
acdlite merged 1 commit intofacebook:masterfrom
acdlite:sync-initial-mount-error
Nov 15, 2017
Merged

Bugfix: nextFlushedRoot should always be set when performing work#11558
acdlite merged 1 commit intofacebook:masterfrom
acdlite:sync-initial-mount-error

Conversation

@acdlite
Copy link
Copy Markdown
Collaborator

@acdlite acdlite commented Nov 15, 2017

Fixes an issue where performWorkOnRoot was called, but nextFlushedRoot was not set. This happened in a special branch where we synchronously flush newly mounted DOM trees outside the normal work loop.

Arguably, performWorkOnRoot should read from the globally assigned root and expiration time instead of accepting arguments, since those arguments are expected to be the same as the global values, anyway. I decided against that since the global values could be null, so reading from them would require extra null checks.

@acdlite acdlite requested a review from sophiebits November 15, 2017 00:39
@acdlite acdlite force-pushed the sync-initial-mount-error branch from fc52d45 to 0486807 Compare November 15, 2017 01:20
@sophiebits sophiebits removed their request for review November 15, 2017 01:24
@sophiebits
Copy link
Copy Markdown
Collaborator

I don't think I know how to review this but thanks for fixing! (Is there a way we could have caught this with a fuzz test? ;))

@acdlite
Copy link
Copy Markdown
Collaborator Author

acdlite commented Nov 15, 2017

Is there a way we could have caught this with a fuzz test? ;)

@sophiebits Theoretically yes. Hard to think of a good error handling fuzz test, though. I'll try to come up with one before the next error handling refactor.

@acdlite acdlite requested a review from sebmarkbage November 15, 2017 16:09
expect(caughtError.message).toBe('child sad');
});

it('uncaught error inside unbatched initial mount', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Test name is a little bit weird. Maybe propagates error instead?

Fixes an issue where performWorkOnRoot was called, but nextFlushedRoot
was not set. This happened in a special branch where we synchronously
flush newly mounted DOM trees outside the normal work loop.

Arguably, performWorkOnRoot should read from the globally assigned root
and expiration time instead of accepting arguments, since those
arguments are expected to be the same as the global values, anyway. I
decided against that since the global values could be null, so reading
from them would require extra null checks.
@acdlite acdlite force-pushed the sync-initial-mount-error branch from 0486807 to 7bbe186 Compare November 15, 2017 18:03
@acdlite acdlite merged commit 77f576c into facebook:master Nov 15, 2017
Ethan-Arrowood pushed a commit to Ethan-Arrowood/react that referenced this pull request Dec 8, 2017
…cebook#11558)

Fixes an issue where performWorkOnRoot was called, but nextFlushedRoot
was not set. This happened in a special branch where we synchronously
flush newly mounted DOM trees outside the normal work loop.

Arguably, performWorkOnRoot should read from the globally assigned root
and expiration time instead of accepting arguments, since those
arguments are expected to be the same as the global values, anyway. I
decided against that since the global values could be null, so reading
from them would require extra null checks.
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.

4 participants