Open predaytor opened 2 days ago
Currently, if the async version of the getLoadContext is used, the context will not be propagated.
getLoadContext
import { type PlatformProxy } from 'wrangler'; import { defaultLocale } from '../app/lib/lingui'; import { linguiServer } from '../app/lib/lingui.server'; type GetLoadContextArgs = { request: Request; context: { cloudflare: Omit<PlatformProxy<Env>, 'dispose' | 'caches' | 'cf'> & { caches: PlatformProxy<Env>['caches'] | CacheStorage; cf: Request['cf']; }; }; }; declare module '@remix-run/cloudflare' { interface AppLoadContext extends Awaited<ReturnType<typeof getLoadContext>> {} } export async function getLoadContext({ context, request }: GetLoadContextArgs) { return { ...context, locale: await linguiServer.getLocale(request) ?? defaultLocale, }; }
For example, cloudflareDevProxyVitePlugin({ getLoadContext }) from @remix-run/dev supports asynchronous callback.
cloudflareDevProxyVitePlugin({ getLoadContext })
@remix-run/dev
Currently, if the async version of the
getLoadContext
is used, the context will not be propagated.For example,
cloudflareDevProxyVitePlugin({ getLoadContext })
from@remix-run/dev
supports asynchronous callback.