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

Try rendering again if a timed out tree receives an update #13921

Merged
merged 1 commit into from
Oct 23, 2018

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Oct 23, 2018

Found a bug related to suspending inside an already mounted tree. While investigating this I noticed we really don't have much coverage of suspended updates — nearly all are testing the initial mount. I think this would greatly benefit from some fuzz testing; still haven't thought of a good test case, though.

@@ -35,19 +35,17 @@ function assertYieldsWereCleared(root) {
}

export function toFlushAndYield(root, expectedYields) {
assertYieldsWereCleared(root);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved these outside because captureAssertion was swallowing the stack trace.

currentFallbackChildFragment,
currentFallbackChildFragment.pendingProps,
currentPrimaryChildFragment,
currentPrimaryChildFragment.pendingProps,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a fix for an oopsies that could have been its own PR, but it was required to get the new test I wrote to pass. I can split it out if I need to.

) {
// The primary children have pending work. Use the normal path
// to attempt to render the primary children again.
return updateSuspenseComponent(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the main fix here.

@@ -23,3 +24,17 @@ export type SuspenseState = {|
// `didTimeout` because it's not set unless the boundary actually commits.
timedOutAt: ExpirationTime,
|};

export function shouldCaptureSuspense(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I split this out because it was getting hard to follow all the nested branches in the throwException function

let nextState = workInProgress.memoizedState;
if (currentState === null) {
const currentState: SuspenseState | null =
current !== null ? current.memoizedState : null;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe this will fix the issue in www, haven't confirmed yet. I'll try on my sandbox shortly.

Found a bug related to suspending inside an already mounted tree. While
investigating this I noticed we really don't have much coverage of
suspended updates. I think this would greatly benefit from some fuzz
testing; still haven't thought of a good test case, though.
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.

I'm not sure this qualifies as a bug. I think we hit this but basically decided that it was fine since eventually it would get unblocked.

@acdlite
Copy link
Collaborator Author

acdlite commented Oct 23, 2018

@sebmarkbage Hmm I remember hitting this issue with context and shrugging it off, not state though. (Oh, and context should just work now that the timed out children remain in the tree. Should add a test for that as a follow up.)

@acdlite acdlite merged commit 55444a6 into facebook:master Oct 23, 2018
jetoneza pushed a commit to jetoneza/react that referenced this pull request Jan 23, 2019
…13921)

Found a bug related to suspending inside an already mounted tree. While
investigating this I noticed we really don't have much coverage of
suspended updates. I think this would greatly benefit from some fuzz
testing; still haven't thought of a good test case, though.
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