MCPcopy Create free account
hub / github.com/code-forge-io/react-router-devtools / getLoadContext

Function getLoadContext

docs/app/server/context.ts:5–22  ·  view source on GitHub ↗
(c: Context)

Source from the content-addressed store, hash-verified

3import { getClientEnv, getServerEnv } from "~/env.server"
4
5export const getLoadContext = async (c: Context) => {
6 // get the locale from the context
7 const locale = i18next.getLocale(c)
8 // get t function for the default namespace
9 const t = await i18next.getFixedT(c)
10 // get the server environment
11 const env = getServerEnv()
12
13 return {
14 lang: locale,
15 t,
16 isProductionDeployment: env.APP_ENV === "production",
17 env,
18 clientEnv: getClientEnv(),
19 // We do not add this to AppLoadContext type because it's not needed in the loaders, but it's used above to handle requests
20 body: c.body,
21 }
22}
23
24interface LoadContext extends Awaited<ReturnType<typeof getLoadContext>> {}
25

Callers

nothing calls this directly

Calls 2

getServerEnvFunction · 0.90
getClientEnvFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…