-
Notifications
You must be signed in to change notification settings - Fork 16
Description
react-router v7.3.0 added middleware: https://reactrouter.com/start/changelog#middleware-unstable
This is already being rapidly adopted by the community as this feature was absent in remix and had been requested for years.
From the changelog:
⚠️ Enabling middleware contains a breaking change to the context parameter passed to your loader/action functions
When this feature is enabled in react-router config, instead of AppLoadContext
, context is an instance of ContextProvider
that developers can use with type-safe contexts (conceptually similar to React.createContext
).
More information: https://reactrouter.com/start/changelog#middleware-context-parameter
The community package react-router-hono-server
has support for this change that may come in handy as a reference. Here's a link to a commit that has some insights:
rphlmr/react-router-hono-server@b5ec792
Any custom getLoadContext
function must now return a Map
. Example:
Another somewhat-related topic is having everything play nice with @cloudflare/vite-plugin
so that local development can closely mirror actual Cloudflare deployment.
(if you try it the Cloudflare vite plugin with rr I found I needed to add unstable_viteEnvironmentApi: true
to rr config for it to successfully on CF)
It may be worth noting the creator/maintainer of react-router-hono-server
has mused on Remix Discord about dropping this project because rr7 middleware has addressed his use-case for a hono server.
I still very much think its important to support hono for a number of reasons and I imagine you (yusukebe) can think of many more!
Thank-you for hono and thank-you for this package!