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

[Synchronous Suspense] Unmounting a suspended class component #13925

Closed
wants to merge 2 commits into from

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Oct 23, 2018

Previously we assumed any mounted class component would have an instance, but that's not the case for classes that suspend outside of Concurrent mode.

Previously we assumed any mounted class component would have an
instance, but that's not the case for classes that suspend outside
of Concurrent mode.
@@ -495,7 +495,10 @@ function commitUnmount(current: Fiber): void {
case ClassComponent: {
safelyDetachRef(current);
const instance = current.stateNode;
if (typeof instance.componentWillUnmount === 'function') {
if (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment pls?

@gaearon
Copy link
Collaborator

gaearon commented Oct 23, 2018

Is that the only case that can bite us?

@acdlite
Copy link
Collaborator Author

acdlite commented Oct 23, 2018

@gaearon Probably not, can't be sure. This category of bug related to committing fibers that didn't actually complete — it's an intentional deviation from our model, to support Suspense outside Concurrent mode. So I wouldn't be shocked if we found more.

@sebmarkbage
Copy link
Collaborator

This doesn't make sense to me. I thought they could all go to indeterminate mode. I don't want to go hunt down adding special cases in the code that we'll have to remove again.

@acdlite
Copy link
Collaborator Author

acdlite commented Oct 23, 2018

@sebmarkbage Classes don't use the indeterminate tag, except module-style components. That's probably a better way to fix it, though — a special tag that indicates the fiber is incomplete.

Are you ok with landing this in the meantime to unblock the release?

@sebmarkbage
Copy link
Collaborator

I'm worried about this not being the last one.

@acdlite
Copy link
Collaborator Author

acdlite commented Oct 23, 2018

Ok I'll open a different PR that adds a new type of work, IncompleteComponent

@acdlite acdlite closed this Oct 23, 2018
@sizebot
Copy link

sizebot commented Oct 23, 2018

Details of bundled changes.

Comparing: 4947fcd...9b2eca0

scheduler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
scheduler.development.js n/a n/a 0 B 19.17 KB 0 B 5.74 KB UMD_DEV
scheduler.production.min.js n/a n/a 0 B 3.16 KB 0 B 1.53 KB UMD_PROD

Generated by 🚫 dangerJS

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.

5 participants