Repository navigation
fetch-router v1.0.1
Patch Changes
-
Fix response bodies leaking when a request is aborted before its handler or middleware returns.
router.fetch()already rejects with the abort reason, but aResponsethat resolved afterward was discarded without cancelling its body, so streaming work behind it, such as rendering a frame, kept running. The router now cancels the body of any response that arrives after the request was aborted. (#12190) -
Inline
{ middleware, handler }actions increateController()androuter.map()controllers now type their handler with their own action middleware, the same as actions passed torouter.get()or created withcreateAction(). Previously only controller middleware reached the handler's context type, even though the action's middleware ran. (#12149) -
Fix router middleware receiving an empty response body when a
GETroute serves aHEADrequest. The router now strips the body after router middleware runs, so middleware sees the same response it would forGET. Middleware that derives the status or headers from the body, such asrender()rejecting when the page shell fails to render, now givesHEADrequests the same result asGETrequests. (#12190) -
RouterContextandMiddlewareContextno longer drop every middleware value when the middleware array contains a conditional entry like...(isDev ? [logger()] : []). Middleware before and after the conditional entry now types the context; the conditional middleware's own values are left out because it may not run. (#12000)let router = createRouter({ middleware: [ ...(process.env.NODE_ENV === 'development' ? [logger()] : []), formData(), render({ assets }), ], }) // Now includes `formData` and `render` type AppContext = RouterContext<typeof router>