Patch Changes
-
New apps now derive
AppContextfrom the router withRouterContext<typeof router>instead of declaring it up front and passing it tocreateRouter<AppContext>(). The explicit type argument turned off middleware inference, so middleware added to the router later (such asformData()) did not show up oncontextin controllers. This also matches the setup shown in the Remix guides. (#11999)Existing generated apps can apply the same setup in
app/router.ts:-import { createRouter, type MiddlewareContext } from 'remix/router' +import { createRouter, type RouterContext } from 'remix/router' -const renderMiddleware = render({ assets }) -type AppContext = MiddlewareContext<[typeof renderMiddleware]> +export const router = createRouter({ + middleware: [staticFiles('./public', { index: false }), render({ assets })], +}) + +export type AppContext = RouterContext<typeof router> declare module 'remix' { interface RouterTypes { context: AppContext } } -export const router = createRouter<AppContext>({ - middleware: [staticFiles('./public', { index: false }), renderMiddleware], -})
-
Bumped
@remix-run/*dependencies: