-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
[Fizz] Allow aborting during render #30488
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
bd5d88a
to
13eeb69
Compare
__DEV__ && enableOwnerStacks ? task.debugTask : null, | ||
); | ||
|
||
if (x === AbortSigil) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we abort sync in a resume, this can happen too right? Therefore you need to handle the same thing in retryReplayTask
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -1580,6 +1601,13 @@ function finishClassComponent( | |||
nextChildren = instance.render(); | |||
} | |||
|
|||
if (request.status === ABORTING) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are so many places we need to check this for Fizz so I think maybe we should just put it after everywhere we call retryNode:
https://github.com/facebook/react/blob/main/packages/react-server/src/ReactFizzServer.js#L2516
Or maybe at least before every return inside retryNode that might have user space code in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed offline. This is tricky b/c we can end up aborting too high. For now we'll just support the obvious places where user code can run like function and class components and lazy initializers. We can revisit and expand support to iterables and other places if we find a strong motivation in the future. The use case for aborting in these other places is a bit esoteric
13eeb69
to
7598d32
Compare
7598d32
to
d9ed043
Compare
Currently if you abort a Fizz render during rendering the render will not complete correctly because there are inconsistencies with task counting. This change updates the abort implementation to allow you to abort from within a render itself. We already landed a similar change for Flight in facebook#29764
d9ed043
to
fb0bd66
Compare
Currently if you abort a Fizz render during rendering the render will not complete correctly because there are inconsistencies with task counting. This change updates the abort implementation to allow you to abort from within a render itself. We already landed a similar change for Flight in #29764 DiffTrain build for [a451de0](a451de0)
Currently if you abort a Fizz render during rendering the render will not complete correctly because there are inconsistencies with task counting. This change updates the abort implementation to allow you to abort from within a render itself. We already landed a similar change for Flight in #29764