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

Bugfix: Fix crash when suspending in shell during useSES re-render #27199

Merged
merged 2 commits into from
Aug 8, 2023

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Aug 7, 2023

This adds a regression test for a bug where, after a store mutation, the updated data causes the shell of the app to suspend.

When re-rendering due to a concurrent store mutation, we must check for the RootDidNotComplete exit status again.

As a follow-up, I'm going to look into to cleaning up the places where we check the exit status, so bugs like these are less likely. I think we might be able to combine most of it into a single switch statement.

acdlite added 2 commits August 7, 2023 14:11
This adds a regression test for a bug where, after a store mutation,
the updated data causes the shell of the app to suspend. Because of
how the code is factored, we're currently failing to check for
this case, leading to an internal error and crash.

A fix is included in the next commits.
When re-rendering due to a concurrent store mutation, we must check
for the RootDidNotComplete exit status again. This fixes the test
introduced in the previous commit.

As a follow-up, I'm going to look into to cleaning up the places where
we check the exit status, so bugs like these are less likely. I think we
might be able to combine most of it into a single switch statement.
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Aug 7, 2023

// Before B renders, mutate the store.
store.set('Updated');
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Before the fix, the test would crash here with an internal error ("Unknown root status")

@react-sizebot
Copy link

Comparing: 997f52f...c8335c5

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 164.38 kB 164.32 kB = 51.77 kB 51.76 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 171.79 kB 171.74 kB = 53.99 kB 53.98 kB
facebook-www/ReactDOM-prod.classic.js = 567.40 kB 567.12 kB = 100.10 kB 100.09 kB
facebook-www/ReactDOM-prod.modern.js = 551.20 kB 550.92 kB = 97.26 kB 97.25 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against c8335c5

@@ -957,8 +938,7 @@ export function performConcurrentWorkOnRoot(
originallyAttemptedLanes,
errorRetryLanes,
);
// We assume the tree is now consistent because we didn't yield to any
// concurrent events.
renderWasConcurrent = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is just for clarity, right? As far as I can tell, it's not read anymore at this point.

Copy link
Collaborator Author

@acdlite acdlite Aug 8, 2023

Choose a reason for hiding this comment

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

yeah :D in case a continue gets added later in the loop or something

@acdlite acdlite merged commit 201becd into facebook:main Aug 8, 2023
github-actions bot pushed a commit that referenced this pull request Aug 8, 2023
…27199)

This adds a regression test for a bug where, after a store mutation, the
updated data causes the shell of the app to suspend.

When re-rendering due to a concurrent store mutation, we must check for
the RootDidNotComplete exit status again.

As a follow-up, I'm going to look into to cleaning up the places where
we check the exit status, so bugs like these are less likely. I think we
might be able to combine most of it into a single switch statement.

DiffTrain build for [201becd](201becd)
kodiakhq bot pushed a commit to vercel/next.js that referenced this pull request Aug 12, 2023
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
…acebook#27199)

This adds a regression test for a bug where, after a store mutation, the
updated data causes the shell of the app to suspend.

When re-rendering due to a concurrent store mutation, we must check for
the RootDidNotComplete exit status again.

As a follow-up, I'm going to look into to cleaning up the places where
we check the exit status, so bugs like these are less likely. I think we
might be able to combine most of it into a single switch statement.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
…27199)

This adds a regression test for a bug where, after a store mutation, the
updated data causes the shell of the app to suspend.

When re-rendering due to a concurrent store mutation, we must check for
the RootDidNotComplete exit status again.

As a follow-up, I'm going to look into to cleaning up the places where
we check the exit status, so bugs like these are less likely. I think we
might be able to combine most of it into a single switch statement.

DiffTrain build for commit 201becd.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants