app/loader.ts

This file loads app shell data on the server.

Use it for data that belongs to the document shell rather than a single route:

  • locale
  • color scheme
  • session snapshot
  • top-level navigation items

The result is exposed to the app through useAppData().

export default async function loadAppData(request: Request) {
  return {
    origin: new URL(request.url).origin
  };
}