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

Reset lastEffect when resuming SuspenseList #18412

Merged
merged 1 commit into from Mar 29, 2020

Conversation

@sebmarkbage
Copy link
Member

@sebmarkbage sebmarkbage commented Mar 28, 2020

We store an effect pointer so we can backtrack in the effect list in some cases. This is a stateful variable. If we interrupt a render we need to reset it.

This field was added after the optimization was added and I didn't remember to reset it here.

Otherwise we end up not resetting the firstEffect so it points to a stale list. As a result children don't end up inserted like we think they were. Then we try to remove them it errors.

It would be nicer to just get rid of the effect list and use the tree for effects instead. Maybe we still need something for deletions tho.

@codesandbox
Copy link

@codesandbox codesandbox bot commented Mar 28, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a86b002:

Sandbox Source
cool-ellis-c1z3o Configuration
@sizebot
Copy link

@sizebot sizebot commented Mar 28, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against a86b002

@sizebot
Copy link

@sizebot sizebot commented Mar 28, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against a86b002

We store an effect pointer so we can backtrack in the effect list in some
cases. This is a stateful variable. If we interrupt a render we need to
reset it.

This field was added after the optimization was added and I didn't remember
to reset it here.

Otherwise we end up not resetting the firstEffect so it points to a stale
list. As a result children don't end up inserted like we think they were.
Then we try to remove them it errors.

It would be nicer to just get rid of the effect list and use the tree for
effects instead. Maybe we still need something for deletions tho.
@sebmarkbage sebmarkbage force-pushed the sebmarkbage:fixsuspenselistbug branch from 00c5575 to a86b002 Mar 28, 2020
Copy link
Member

@gaearon gaearon left a comment

I don't understand it but I trust you this works

() => updateHighPri(true),
);

// That will intercept the previous render.

This comment has been minimized.

@gaearon

gaearon Mar 29, 2020
Member

interrupt? :-)

// First attempt at high pri.
'Suspend! [A]',
'Loading A',
// Re-render at forced.

This comment has been minimized.

@gaearon

gaearon Mar 29, 2020
Member

What does "forced" mean here? Which branch does it correspond to? Explain like I'm five.

This comment has been minimized.

@sebmarkbage

sebmarkbage Mar 29, 2020
Author Member

SuspenseList sets the suspense context that during render “forces” the suspense boundary into fallback state.

In this case it’s only one boundary so it doesn’t need to but we don’t know. If there was another boundary in the row we would have to rerender that one so that’s the second pass.

This comment has been minimized.

@gaearon

gaearon Mar 29, 2020
Member

Ohh that makes sense! I didn’t realize it works this way.

// Re-render at forced.
'Suspend! [A]',
'Loading A',
// We auto-commit this on DEV.

This comment has been minimized.

@gaearon

gaearon Mar 29, 2020
Member

Why? "Flush fallbacks" flag?

This comment has been minimized.

@sebmarkbage

sebmarkbage Mar 29, 2020
Author Member

Yea

'Suspend! [A]',
'Loading A',
]
: [

This comment has been minimized.

@gaearon

gaearon Mar 29, 2020
Member

This test is verifying the same logs appear three or four times. But how do we know the comments are actually telling the truth? Can we include the boolean values in logs so that we know we're actually rendering at the priority suggested by comments?

This comment has been minimized.

@sebmarkbage

sebmarkbage Mar 29, 2020
Author Member

I’d rather just delete this assertion. It’s unrelated. It’s just that Scheduler expects force me to assert. This is super suboptimal so it’ll change by heuristics a lot.

@sebmarkbage sebmarkbage merged commit 689d275 into facebook:master Mar 29, 2020
31 checks passed
31 checks passed
ci/circleci: NODE_ENV_production_yarn_test_www Your tests passed on CircleCI!
Details
ci/circleci: NODE_ENV_production_yarn_test_www_variant Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_NODE_ENV_production_yarn_test_www Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_NODE_ENV_production_yarn_test_www_variant Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_build Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_build Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_build_prod Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_dom_fixtures Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_persistent Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_prod Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_www Your tests passed on CircleCI!
Details
ci/circleci: RELEASE_CHANNEL_stable_yarn_test_www_variant Your tests passed on CircleCI!
Details
ci/circleci: build_devtools_and_process_artifacts Your tests passed on CircleCI!
Details
ci/circleci: process_artifacts Your tests passed on CircleCI!
Details
ci/circleci: process_artifacts_experimental Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: sizebot_experimental Your tests passed on CircleCI!
Details
ci/circleci: sizebot_stable Your tests passed on CircleCI!
Details
ci/circleci: yarn_build Your tests passed on CircleCI!
Details
ci/circleci: yarn_flow Your tests passed on CircleCI!
Details
ci/circleci: yarn_lint Your tests passed on CircleCI!
Details
ci/circleci: yarn_lint_build Your tests passed on CircleCI!
Details
ci/circleci: yarn_test Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_build Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_build_devtools Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_build_prod Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_prod Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_www Your tests passed on CircleCI!
Details
ci/circleci: yarn_test_www_variant Your tests passed on CircleCI!
Details
ci/codesandbox Building packages succeeded.
Details
@gaearon gaearon mentioned this pull request Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.