-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix(remix-express,remix-vercel): fix request.signal
#3626
Conversation
req.on("close", () => { | ||
controller.abort(); | ||
}); | ||
res.on("close", () => controller.abort()); |
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.
Abort on response close
instead of request close
expect(await app.getHtml(".loader")).toMatch("false"); | ||
|
||
await app.clickElement('button[type="submit"]'); | ||
expect(await app.getHtml(".action")).toMatch("false"); |
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.
Prior to the fix this would be true
Hm - seems to be failing CI on a
|
🦋 Changeset detectedLatest commit: 70ca93c The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
request.signal
🤖 Hello there, We just published version Thanks! |
This PR fixes the signal we assign to our Fetch
Request
in Express + Vercel. We used to abort the signal on theclose
event on the Express/VercelRequest
, but inPOST
's this happens to be as soon as we've consumed the body, so any async flow in anaction
causes the signal to be aborted:Instead we should we aborting our server-side processing of the request as soon as we are no longer able to send a
Response
, so we can listen for the Express/VercelResponse
close
event instead.Open Questions:
signal
is not immediately aborted, but curious if we have a way to assert that it's correctly aborted if theresponse
closes?fetch
request from the browser and manually triggering itsAbortController
- and then checking the console logs on the Remix server. Unsure if we can get at that level of info via our integration harness?signal
on the incomingrequest
so we rely on them to trigger abort the signal properly on their endsignal
available, and we do not create one sorequest.signal == null
inside our Remix code. This will potentially be problematic when we pull in the new router since it will be relying on the existing signal. We can either just make our references defensive viarequest.signal?.aborted
, but it would be better if we could find some way to wire up a legitsignal
?signal
(which will never be aborted) for these and added aninvariant(request.signal)
increateStaticHandler.query
to better align with theRequest
typings