-
Notifications
You must be signed in to change notification settings - Fork 47k
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
[Flight] do not emit error after abort #30683
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Comparing: 8e60bac...52e76a5 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
@@ -2183,7 +2183,7 @@ function renderModel( | |||
} | |||
} | |||
|
|||
if (thrownValue === AbortSigil) { | |||
if (request.status === ABORTING || x === AbortSymbol) { |
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.
No need to compare against the symbol since all cases it is thrown.
0898d51
to
62fcdc8
Compare
I updated the impl, needs another look
@@ -591,9 +589,11 @@ function serializeThenable( | |||
logPostpone(request, postponeInstance.message, newTask); |
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.
Shouldn't postpone get the same treatment?
62fcdc8
to
129c46f
Compare
129c46f
to
5772a5c
Compare
When synchronously aborting in a non-async Function Component if you throw after aborting the task would error rather than abort because React never observed the AbortSignal. This change adds an additional check to see if the request is currently aborting. I left the sigil check in place too in case a task pings after the request is closed (though I'm pretty sure that can't actually happen) I also renamed AbortSigil to AbortSymbol and changed it to a Symbol to make some of the duck typing more efficient.
5772a5c
to
e86eab1
Compare
When synchronously aborting in a non-async Function Component if you throw after aborting the task would error rather than abort because React never observed the AbortSignal.
Using a sigil to throw after aborting during render isn't effective b/c the user code itself could throw so insteead we just read the request status. This is ok b/c we don't expect any tasks to still be pending after the currently running task finishes.
However I found one instance where that wasn't true related to serializing thenables which I've fixed so we may find other cases. If we do, though it's almost certainly a bug in our task bookkeeping so we should just fix it if it comes up.
I also updated
abort
to not set the status to ABORTING unless the status was OPEN. we don't want to ever leave CLOSED or CLOSING status