Skip to content

loadRouteData

Describes@ebitex/content-sdk 1.xSee the changelog:@ebitex/content-sdk

loadRouteData(definitions, route, options?): Promise<LoadedRouteData>

Loads the data a route needs, without React: for a server that resolved the page, to answer a real 404 before rendering and to hand the values to <Experience initialRouteData> so the browser does not load them again.

const result = await client.resolveLocation(url)
const data = result.kind === 'presentation' ? await loadRouteData([personData], result.route, { locale: result.locale }) : undefined
if (data?.notFound) return new Response('Not found', { status: 404 })

Only definitions whose tag matches the route’s run; with no route (an ordinary page) nothing runs. A definition for another address is skipped, never an error, in either mode. A loader’s own errors reject this promise.

readonly AnyRouteDataDefinition[]

RouteResult | undefined

string

AbortSignal

Promise<LoadedRouteData>