#cloudflare workers + rr v7 + unstable_middleware
1 messages · Page 1 of 1 (latest)
I'm not using a getLoadContext function and just create the initial context inline.
const context = new unstable_RouterContextProvider();
context.set(appLoadContext, {
cloudflare: { env, ctx },
auth,
session:
(await auth.api.getSession({ headers: c.req.raw.headers })) ??
undefined,
});
const requestHandler = createRequestHandler(
() => import("virtual:react-router/server-build"),
import.meta.env.MODE,
);
return requestHandler(c.req.raw, context);
I wonder if you need to refactor your getLoadContext function to return a unstable_RouterContextProvider instead of an object per https://reactrouter.com/how-to/middleware#4-update-your-getloadcontext-function-if-applicable
i did something similar