@payloadcms/tanstack-start 4.0.0-beta.2 → 4.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/adapters/handleServerFunctions.d.ts +2 -1
  2. package/dist/adapters/handleServerFunctions.d.ts.map +1 -1
  3. package/dist/adapters/handleServerFunctions.js +12 -4
  4. package/dist/adapters/handleServerFunctions.js.map +1 -1
  5. package/dist/adapters/layout/RootProviders/index.d.ts +9 -0
  6. package/dist/adapters/layout/RootProviders/index.d.ts.map +1 -0
  7. package/dist/adapters/layout/RootProviders/index.js +21 -0
  8. package/dist/adapters/layout/RootProviders/index.js.map +1 -0
  9. package/dist/adapters/layout/index.d.ts +7 -4
  10. package/dist/adapters/layout/index.d.ts.map +1 -1
  11. package/dist/adapters/layout/index.js +3 -1
  12. package/dist/adapters/layout/index.js.map +1 -1
  13. package/dist/adapters/layout/lazy.d.ts +1 -5
  14. package/dist/adapters/layout/lazy.d.ts.map +1 -1
  15. package/dist/adapters/layout/lazy.js +9 -15
  16. package/dist/adapters/layout/lazy.js.map +1 -1
  17. package/dist/adapters/layout/outlet.d.ts +4 -0
  18. package/dist/adapters/layout/outlet.d.ts.map +1 -0
  19. package/dist/adapters/layout/outlet.js +9 -0
  20. package/dist/adapters/layout/outlet.js.map +1 -0
  21. package/dist/adapters/layout/server.d.ts +7 -13
  22. package/dist/adapters/layout/server.d.ts.map +1 -1
  23. package/dist/adapters/layout/server.js +18 -16
  24. package/dist/adapters/layout/server.js.map +1 -1
  25. package/dist/adapters/views/index.d.ts +5 -2
  26. package/dist/adapters/views/index.d.ts.map +1 -1
  27. package/dist/adapters/views/index.js +10 -4
  28. package/dist/adapters/views/index.js.map +1 -1
  29. package/dist/adapters/views/lazy.js +2 -2
  30. package/dist/adapters/views/lazy.js.map +1 -1
  31. package/dist/adapters/views/server.d.ts +5 -2
  32. package/dist/adapters/views/server.d.ts.map +1 -1
  33. package/dist/adapters/views/server.js +12 -3
  34. package/dist/adapters/views/server.js.map +1 -1
  35. package/dist/exports/client/layout.d.ts +2 -0
  36. package/dist/exports/client/layout.d.ts.map +1 -0
  37. package/dist/exports/client/layout.js +4 -0
  38. package/dist/exports/client/layout.js.map +1 -0
  39. package/dist/exports/client.d.ts +1 -1
  40. package/dist/exports/client.d.ts.map +1 -1
  41. package/dist/exports/client.js +1 -1
  42. package/dist/exports/client.js.map +1 -1
  43. package/dist/exports/server.d.ts +0 -2
  44. package/dist/exports/server.d.ts.map +1 -1
  45. package/dist/exports/server.js +0 -2
  46. package/dist/exports/server.js.map +1 -1
  47. package/dist/utilities/serverFunctionClient.d.ts +2 -23
  48. package/dist/utilities/serverFunctionClient.d.ts.map +1 -1
  49. package/dist/utilities/serverFunctionClient.js +12 -106
  50. package/dist/utilities/serverFunctionClient.js.map +1 -1
  51. package/package.json +16 -16
  52. package/dist/utilities/serializeForRsc.d.ts +0 -26
  53. package/dist/utilities/serializeForRsc.d.ts.map +0 -1
  54. package/dist/utilities/serializeForRsc.js +0 -127
  55. package/dist/utilities/serializeForRsc.js.map +0 -1
  56. package/dist/utilities/toSerializable.d.ts +0 -11
  57. package/dist/utilities/toSerializable.d.ts.map +0 -1
  58. package/dist/utilities/toSerializable.js +0 -127
  59. package/dist/utilities/toSerializable.js.map +0 -1
@@ -1,2 +1,3 @@
1
- export declare const handleServerFunctions: import("payload").ServerFunctionHandler;
1
+ import type { ServerFunctionHandler } from 'payload';
2
+ export declare function handleServerFunctions(args: Parameters<ServerFunctionHandler>[0]): Promise<Response>;
2
3
  //# sourceMappingURL=handleServerFunctions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleServerFunctions.d.ts","sourceRoot":"","sources":["../../src/adapters/handleServerFunctions.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,yCAGhC,CAAA"}
1
+ {"version":3,"file":"handleServerFunctions.d.ts","sourceRoot":"","sources":["../../src/adapters/handleServerFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAUpD,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,GACzC,OAAO,CAAC,QAAQ,CAAC,CAOnB"}
@@ -1,9 +1,17 @@
1
1
  import { createServerFunctionHandler } from '@payloadcms/ui/utilities/handleServerFunctions';
2
+ import { renderToReadableStream } from '@tanstack/react-start/rsc';
2
3
  import { initAdminContext } from '../utilities/initAdminContext.server.js';
3
- import { serializeForRsc } from '../utilities/serializeForRsc.js';
4
- export const handleServerFunctions = createServerFunctionHandler({
5
- initAdminContext,
6
- transformResult: serializeForRsc
4
+ const runServerFunction = createServerFunctionHandler({
5
+ initAdminContext
7
6
  });
7
+ export async function handleServerFunctions(args) {
8
+ const result = await runServerFunction(args);
9
+ // Flight accepts complete models; TanStack's non-RSC declaration only accepts ReactNode.
10
+ return new Response(renderToReadableStream(result), {
11
+ headers: {
12
+ 'Content-Type': 'text/x-component'
13
+ }
14
+ });
15
+ }
8
16
 
9
17
  //# sourceMappingURL=handleServerFunctions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/adapters/handleServerFunctions.ts"],"sourcesContent":["import { createServerFunctionHandler } from '@payloadcms/ui/utilities/handleServerFunctions'\n\nimport { initAdminContext } from '../utilities/initAdminContext.server.js'\nimport { serializeForRsc } from '../utilities/serializeForRsc.js'\n\nexport const handleServerFunctions = createServerFunctionHandler({\n initAdminContext,\n transformResult: serializeForRsc,\n})\n"],"names":["createServerFunctionHandler","initAdminContext","serializeForRsc","handleServerFunctions","transformResult"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,iDAAgD;AAE5F,SAASC,gBAAgB,QAAQ,0CAAyC;AAC1E,SAASC,eAAe,QAAQ,kCAAiC;AAEjE,OAAO,MAAMC,wBAAwBH,4BAA4B;IAC/DC;IACAG,iBAAiBF;AACnB,GAAE"}
1
+ {"version":3,"sources":["../../src/adapters/handleServerFunctions.ts"],"sourcesContent":["import type { ServerFunctionHandler } from 'payload'\nimport type { ReactNode } from 'react'\n\nimport { createServerFunctionHandler } from '@payloadcms/ui/utilities/handleServerFunctions'\nimport { renderToReadableStream } from '@tanstack/react-start/rsc'\n\nimport { initAdminContext } from '../utilities/initAdminContext.server.js'\n\nconst runServerFunction = createServerFunctionHandler({ initAdminContext })\n\nexport async function handleServerFunctions(\n args: Parameters<ServerFunctionHandler>[0],\n): Promise<Response> {\n const result = await runServerFunction(args)\n\n // Flight accepts complete models; TanStack's non-RSC declaration only accepts ReactNode.\n return new Response(renderToReadableStream(result as ReactNode), {\n headers: { 'Content-Type': 'text/x-component' },\n })\n}\n"],"names":["createServerFunctionHandler","renderToReadableStream","initAdminContext","runServerFunction","handleServerFunctions","args","result","Response","headers"],"mappings":"AAGA,SAASA,2BAA2B,QAAQ,iDAAgD;AAC5F,SAASC,sBAAsB,QAAQ,4BAA2B;AAElE,SAASC,gBAAgB,QAAQ,0CAAyC;AAE1E,MAAMC,oBAAoBH,4BAA4B;IAAEE;AAAiB;AAEzE,OAAO,eAAeE,sBACpBC,IAA0C;IAE1C,MAAMC,SAAS,MAAMH,kBAAkBE;IAEvC,yFAAyF;IACzF,OAAO,IAAIE,SAASN,uBAAuBK,SAAsB;QAC/DE,SAAS;YAAE,gBAAgB;QAAmB;IAChD;AACF"}
@@ -0,0 +1,9 @@
1
+ import type { ServerFunctionClient } from 'payload';
2
+ import React from 'react';
3
+ import type { RootLayoutData } from '../server.js';
4
+ export declare const ServerFunctionContext: React.Context<ServerFunctionClient | undefined>;
5
+ /** Binds the decoded layout model to the app's client-local dispatcher. */
6
+ export declare function PayloadRootProviders({ data }: {
7
+ data: RootLayoutData;
8
+ }): React.JSX.Element;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/layout/RootProviders/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAInD,OAAO,KAA6B,MAAM,OAAO,CAAA;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAIlD,eAAO,MAAM,qBAAqB,iDAA6D,CAAA;AAE/F,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,qBAgBtE"}
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { RootProviders } from '@payloadcms/ui';
4
+ import { Outlet } from '@tanstack/react-router';
5
+ import React, { createContext, use } from 'react';
6
+ import { TanStackRouterAdapter } from '../../router.js';
7
+ export const ServerFunctionContext = /*#__PURE__*/ createContext(undefined);
8
+ /** Binds the decoded layout model to the app's client-local dispatcher. */ export function PayloadRootProviders({ data }) {
9
+ const serverFunction = use(ServerFunctionContext);
10
+ if (!serverFunction) {
11
+ throw new Error('PayloadRootProviders must be rendered within PayloadLayout');
12
+ }
13
+ return /*#__PURE__*/ _jsx(RootProviders, {
14
+ data: data,
15
+ RouterAdapter: TanStackRouterAdapter,
16
+ serverFunction: serverFunction,
17
+ children: data.providers ?? /*#__PURE__*/ _jsx(Outlet, {})
18
+ });
19
+ }
20
+
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/adapters/layout/RootProviders/index.tsx"],"sourcesContent":["'use client'\nimport type { ServerFunctionClient } from 'payload'\n\nimport { RootProviders } from '@payloadcms/ui'\nimport { Outlet } from '@tanstack/react-router'\nimport React, { createContext, use } from 'react'\n\nimport type { RootLayoutData } from '../server.js'\n\nimport { TanStackRouterAdapter } from '../../router.js'\n\nexport const ServerFunctionContext = createContext<ServerFunctionClient | undefined>(undefined)\n\n/** Binds the decoded layout model to the app's client-local dispatcher. */\nexport function PayloadRootProviders({ data }: { data: RootLayoutData }) {\n const serverFunction = use(ServerFunctionContext)\n\n if (!serverFunction) {\n throw new Error('PayloadRootProviders must be rendered within PayloadLayout')\n }\n\n return (\n <RootProviders\n data={data}\n RouterAdapter={TanStackRouterAdapter}\n serverFunction={serverFunction}\n >\n {data.providers ?? <Outlet />}\n </RootProviders>\n )\n}\n"],"names":["RootProviders","Outlet","React","createContext","use","TanStackRouterAdapter","ServerFunctionContext","undefined","PayloadRootProviders","data","serverFunction","Error","RouterAdapter","providers"],"mappings":"AAAA;;AAGA,SAASA,aAAa,QAAQ,iBAAgB;AAC9C,SAASC,MAAM,QAAQ,yBAAwB;AAC/C,OAAOC,SAASC,aAAa,EAAEC,GAAG,QAAQ,QAAO;AAIjD,SAASC,qBAAqB,QAAQ,kBAAiB;AAEvD,OAAO,MAAMC,sCAAwBH,cAAgDI,WAAU;AAE/F,yEAAyE,GACzE,OAAO,SAASC,qBAAqB,EAAEC,IAAI,EAA4B;IACrE,MAAMC,iBAAiBN,IAAIE;IAE3B,IAAI,CAACI,gBAAgB;QACnB,MAAM,IAAIC,MAAM;IAClB;IAEA,qBACE,KAACX;QACCS,MAAMA;QACNG,eAAeP;QACfK,gBAAgBA;kBAEfD,KAAKI,SAAS,kBAAI,KAACZ;;AAG1B"}
@@ -41,10 +41,11 @@ export declare function withPayloadRoot(RootShell: React.ComponentType<{
41
41
  }) => React.JSX.Element;
42
42
  /**
43
43
  * Loader supplied by the app — a TanStack Start `createServerFn` that delegates
44
- * to `loadLayoutData`. Typed loosely because the server-fn's call signature is
45
- * generated by the Start compiler.
44
+ * to `loadLayoutData`.
46
45
  */
47
- export type LayoutLoad = () => Promise<LoadLayoutDataResult>;
46
+ export type LayoutLoad = (opts?: {
47
+ signal?: AbortSignal;
48
+ }) => Promise<LoadLayoutDataResult>;
48
49
  /**
49
50
  * Route options for the Payload admin layout (`/_payload`). The app supplies
50
51
  * `load` (the layout-data server fn) and `serverFunction` (the server-function
@@ -59,7 +60,9 @@ export declare function payloadLayoutRoute({ load, serverFunction, }: {
59
60
  preload: (() => Promise<void> | undefined) | undefined;
60
61
  };
61
62
  loader: {
62
- handler: () => Promise<import("../../utilities/toSerializable.js").SerializableRecord>;
63
+ handler: ({ abortController }: {
64
+ abortController: AbortController;
65
+ }) => Promise<LoadLayoutDataResult>;
63
66
  staleReloadMode: 'blocking';
64
67
  };
65
68
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/layout/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAInD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CACnC,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE,sBAAsB,qBA+BrE;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC,EAC7D,OAAO,GAAE,sBAA2B,kBAIW;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,uBAc7E;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAA;AAM5D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,cAAc,GACf,EAAE;IACD,IAAI,EAAE,UAAU,CAAA;IAChB,cAAc,EAAE,oBAAoB,CAAA;CACrC;IAUG,SAAS;;;;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9 @@ const PayloadLayout = lazyRouteComponent(()=>import('./lazy.js'), 'PayloadLayout
96
96
  return {
97
97
  component: PayloadLayoutRoute,
98
98
  loader: {
99
- handler: ()=>load(),
99
+ handler: ({ abortController })=>load({
100
+ signal: abortController.signal
101
+ }),
100
102
  staleReloadMode: 'blocking'
101
103
  }
102
104
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapters/layout/index.tsx"],"sourcesContent":["'use client'\nimport type { DocumentRootProps } from '@payloadcms/ui/layouts/DocumentRoot'\nimport type { RootLayoutData } from '@payloadcms/ui/layouts/Root/getRootLayoutData'\nimport type { ServerFunctionClient } from 'payload'\n\nimport { DocumentRoot } from '@payloadcms/ui/layouts/DocumentRoot'\nimport { HeadContent, lazyRouteComponent, Scripts, useRouterState } from '@tanstack/react-router'\nimport React from 'react'\n\nimport type { LoadLayoutDataResult } from './server.js'\n\nexport type PayloadAdminShellProps = {\n readonly children: React.ReactNode\n}\n\n/**\n * The `<html>` document shell for Payload admin routes — the TanStack Start\n * equivalent of `@payloadcms/next`'s root layout `<html>`. Sets\n * `data-theme`/`lang`/`dir` on `<html>` from the server-computed layout data\n * (`getLayoutData`, exposed on the `/_payload` route loader), so the admin\n * panel shares document rendering and request preferences with Next's `RootLayout`.\n * A blocking script resolves the default theme from the browser preference before first paint.\n */\nexport function PayloadAdminShell({ children }: PayloadAdminShellProps) {\n const documentProps = useRouterState({\n select: (state): Partial<DocumentRootProps> => {\n for (const match of state.matches) {\n const data = match.loaderData as Partial<RootLayoutData> | undefined\n\n if (data?.theme && data?.languageCode) {\n return {\n dir: data.dir,\n highContrastMode: data.highContrastMode,\n languageCode: data.languageCode,\n suppressHydrationWarning: data.suppressHydrationWarning,\n theme: data.theme,\n themeSource: data.themeSource ?? 'default',\n }\n }\n }\n\n // No layout data yet (fresh session before the loader resolves): default\n // to `ltr` so the `[dir='ltr']`-scoped admin layout rules (e.g. the\n // document sidebar divider) still match, matching Next's `ltr` default.\n return { dir: 'ltr', suppressHydrationWarning: true, themeSource: 'default' }\n },\n })\n\n return (\n <DocumentRoot {...documentProps} head={<HeadContent />}>\n {children}\n <Scripts />\n </DocumentRoot>\n )\n}\n\nexport type WithPayloadRootOptions = {\n /**\n * Path prefix that mounts the Payload admin panel (`config.routes.admin`).\n * Routes under it render the Payload admin document shell; everything else\n * renders your own shell. Defaults to `'/admin'`.\n */\n adminRoute?: string\n}\n\n/**\n * Wraps your application's root document shell so Payload owns its own\n * `<html>` chrome on admin routes while your shell renders everywhere else.\n *\n * Attach the result to the root route's `shellComponent`; it is the single\n * integration touch point — no root loader and no manual data threading:\n *\n * ```tsx\n * export const Route = createRootRoute({\n * shellComponent: withPayloadRoot(MarketingRoot),\n * })\n * ```\n */\nexport function withPayloadRoot(\n RootShell: React.ComponentType<{ children: React.ReactNode }>,\n options: WithPayloadRootOptions = {},\n) {\n const { adminRoute = '/admin' } = options\n\n return function PayloadRootShell({ children }: { children: React.ReactNode }) {\n const isAdminRoute = useRouterState({\n select: (s) => {\n const { pathname } = s.location\n return pathname === adminRoute || pathname.startsWith(`${adminRoute}/`)\n },\n })\n\n if (isAdminRoute) {\n return <PayloadAdminShell>{children}</PayloadAdminShell>\n }\n\n return <RootShell>{children}</RootShell>\n }\n}\n\n/**\n * Loader supplied by the app — a TanStack Start `createServerFn` that delegates\n * to `loadLayoutData`. Typed loosely because the server-fn's call signature is\n * generated by the Start compiler.\n */\nexport type LayoutLoad = () => Promise<LoadLayoutDataResult>\n\n// The admin UI loads with the admin routes only, so front-end routes never download it. The\n// router preloads lazy route components before rendering, so admin pages don't flash.\nconst PayloadLayout = lazyRouteComponent(() => import('./lazy.js'), 'PayloadLayout')\n\n/**\n * Route options for the Payload admin layout (`/_payload`). The app supplies\n * `load` (the layout-data server fn) and `serverFunction` (the server-function\n * client wired into `RootProviders`); everything else is adapter-owned.\n */\nexport function payloadLayoutRoute({\n load,\n serverFunction,\n}: {\n load: LayoutLoad\n serverFunction: ServerFunctionClient\n}) {\n function PayloadLayoutRoute() {\n return <PayloadLayout serverFunction={serverFunction} />\n }\n PayloadLayoutRoute.preload = PayloadLayout.preload\n\n // `staleReloadMode` lives on the loader *object* — router-core only reads it\n // off a non-function loader — so stale-match revalidation blocks on the fresh\n // loader instead of flashing stale layout data via the default background SWR.\n return {\n component: PayloadLayoutRoute,\n loader: { handler: () => load(), staleReloadMode: 'blocking' as const },\n }\n}\n"],"names":["DocumentRoot","HeadContent","lazyRouteComponent","Scripts","useRouterState","React","PayloadAdminShell","children","documentProps","select","state","match","matches","data","loaderData","theme","languageCode","dir","highContrastMode","suppressHydrationWarning","themeSource","head","withPayloadRoot","RootShell","options","adminRoute","PayloadRootShell","isAdminRoute","s","pathname","location","startsWith","PayloadLayout","payloadLayoutRoute","load","serverFunction","PayloadLayoutRoute","preload","component","loader","handler","staleReloadMode"],"mappings":"AAAA;;AAKA,SAASA,YAAY,QAAQ,sCAAqC;AAClE,SAASC,WAAW,EAAEC,kBAAkB,EAAEC,OAAO,EAAEC,cAAc,QAAQ,yBAAwB;AACjG,OAAOC,WAAW,QAAO;AAQzB;;;;;;;CAOC,GACD,OAAO,SAASC,kBAAkB,EAAEC,QAAQ,EAA0B;IACpE,MAAMC,gBAAgBJ,eAAe;QACnCK,QAAQ,CAACC;YACP,KAAK,MAAMC,SAASD,MAAME,OAAO,CAAE;gBACjC,MAAMC,OAAOF,MAAMG,UAAU;gBAE7B,IAAID,MAAME,SAASF,MAAMG,cAAc;oBACrC,OAAO;wBACLC,KAAKJ,KAAKI,GAAG;wBACbC,kBAAkBL,KAAKK,gBAAgB;wBACvCF,cAAcH,KAAKG,YAAY;wBAC/BG,0BAA0BN,KAAKM,wBAAwB;wBACvDJ,OAAOF,KAAKE,KAAK;wBACjBK,aAAaP,KAAKO,WAAW,IAAI;oBACnC;gBACF;YACF;YAEA,yEAAyE;YACzE,oEAAoE;YACpE,wEAAwE;YACxE,OAAO;gBAAEH,KAAK;gBAAOE,0BAA0B;gBAAMC,aAAa;YAAU;QAC9E;IACF;IAEA,qBACE,MAACpB;QAAc,GAAGQ,aAAa;QAAEa,oBAAM,KAACpB;;YACrCM;0BACD,KAACJ;;;AAGP;AAWA;;;;;;;;;;;;CAYC,GACD,OAAO,SAASmB,gBACdC,SAA6D,EAC7DC,UAAkC,CAAC,CAAC;IAEpC,MAAM,EAAEC,aAAa,QAAQ,EAAE,GAAGD;IAElC,OAAO,SAASE,iBAAiB,EAAEnB,QAAQ,EAAiC;QAC1E,MAAMoB,eAAevB,eAAe;YAClCK,QAAQ,CAACmB;gBACP,MAAM,EAAEC,QAAQ,EAAE,GAAGD,EAAEE,QAAQ;gBAC/B,OAAOD,aAAaJ,cAAcI,SAASE,UAAU,CAAC,GAAGN,WAAW,CAAC,CAAC;YACxE;QACF;QAEA,IAAIE,cAAc;YAChB,qBAAO,KAACrB;0BAAmBC;;QAC7B;QAEA,qBAAO,KAACgB;sBAAWhB;;IACrB;AACF;AASA,4FAA4F;AAC5F,sFAAsF;AACtF,MAAMyB,gBAAgB9B,mBAAmB,IAAM,MAAM,CAAC,cAAc;AAEpE;;;;CAIC,GACD,OAAO,SAAS+B,mBAAmB,EACjCC,IAAI,EACJC,cAAc,EAIf;IACC,SAASC;QACP,qBAAO,KAACJ;YAAcG,gBAAgBA;;IACxC;IACAC,mBAAmBC,OAAO,GAAGL,cAAcK,OAAO;IAElD,6EAA6E;IAC7E,8EAA8E;IAC9E,+EAA+E;IAC/E,OAAO;QACLC,WAAWF;QACXG,QAAQ;YAAEC,SAAS,IAAMN;YAAQO,iBAAiB;QAAoB;IACxE;AACF"}
1
+ {"version":3,"sources":["../../../src/adapters/layout/index.tsx"],"sourcesContent":["'use client'\nimport type { DocumentRootProps } from '@payloadcms/ui/layouts/DocumentRoot'\nimport type { ServerFunctionClient } from 'payload'\n\nimport { DocumentRoot } from '@payloadcms/ui/layouts/DocumentRoot'\nimport { HeadContent, lazyRouteComponent, Scripts, useRouterState } from '@tanstack/react-router'\nimport React from 'react'\n\nimport type { LoadLayoutDataResult } from './server.js'\n\nexport type PayloadAdminShellProps = {\n readonly children: React.ReactNode\n}\n\n/**\n * The `<html>` document shell for Payload admin routes — the TanStack Start\n * equivalent of `@payloadcms/next`'s root layout `<html>`. Sets\n * `data-theme`/`lang`/`dir` on `<html>` from the server-computed layout data\n * (`getLayoutData`, exposed on the `/_payload` route loader), so the admin\n * panel shares document rendering and request preferences with Next's `RootLayout`.\n * A blocking script resolves the default theme from the browser preference before first paint.\n */\nexport function PayloadAdminShell({ children }: PayloadAdminShellProps) {\n const documentProps = useRouterState({\n select: (state): Partial<DocumentRootProps> => {\n for (const match of state.matches) {\n const data = match.loaderData as Partial<LoadLayoutDataResult> | undefined\n\n if (data?.theme && data?.languageCode) {\n return {\n dir: data.dir,\n highContrastMode: data.highContrastMode,\n languageCode: data.languageCode,\n suppressHydrationWarning: data.suppressHydrationWarning,\n theme: data.theme,\n themeSource: data.themeSource ?? 'default',\n }\n }\n }\n\n // No layout data yet (fresh session before the loader resolves): default\n // to `ltr` so the `[dir='ltr']`-scoped admin layout rules (e.g. the\n // document sidebar divider) still match, matching Next's `ltr` default.\n return { dir: 'ltr', suppressHydrationWarning: true, themeSource: 'default' }\n },\n })\n\n return (\n <DocumentRoot {...documentProps} head={<HeadContent />}>\n {children}\n <Scripts />\n </DocumentRoot>\n )\n}\n\nexport type WithPayloadRootOptions = {\n /**\n * Path prefix that mounts the Payload admin panel (`config.routes.admin`).\n * Routes under it render the Payload admin document shell; everything else\n * renders your own shell. Defaults to `'/admin'`.\n */\n adminRoute?: string\n}\n\n/**\n * Wraps your application's root document shell so Payload owns its own\n * `<html>` chrome on admin routes while your shell renders everywhere else.\n *\n * Attach the result to the root route's `shellComponent`; it is the single\n * integration touch point — no root loader and no manual data threading:\n *\n * ```tsx\n * export const Route = createRootRoute({\n * shellComponent: withPayloadRoot(MarketingRoot),\n * })\n * ```\n */\nexport function withPayloadRoot(\n RootShell: React.ComponentType<{ children: React.ReactNode }>,\n options: WithPayloadRootOptions = {},\n) {\n const { adminRoute = '/admin' } = options\n\n return function PayloadRootShell({ children }: { children: React.ReactNode }) {\n const isAdminRoute = useRouterState({\n select: (s) => {\n const { pathname } = s.location\n return pathname === adminRoute || pathname.startsWith(`${adminRoute}/`)\n },\n })\n\n if (isAdminRoute) {\n return <PayloadAdminShell>{children}</PayloadAdminShell>\n }\n\n return <RootShell>{children}</RootShell>\n }\n}\n\n/**\n * Loader supplied by the app — a TanStack Start `createServerFn` that delegates\n * to `loadLayoutData`.\n */\nexport type LayoutLoad = (opts?: { signal?: AbortSignal }) => Promise<LoadLayoutDataResult>\n\n// The admin UI loads with the admin routes only, so front-end routes never download it. The\n// router preloads lazy route components before rendering, so admin pages don't flash.\nconst PayloadLayout = lazyRouteComponent(() => import('./lazy.js'), 'PayloadLayout')\n\n/**\n * Route options for the Payload admin layout (`/_payload`). The app supplies\n * `load` (the layout-data server fn) and `serverFunction` (the server-function\n * client wired into `RootProviders`); everything else is adapter-owned.\n */\nexport function payloadLayoutRoute({\n load,\n serverFunction,\n}: {\n load: LayoutLoad\n serverFunction: ServerFunctionClient\n}) {\n function PayloadLayoutRoute() {\n return <PayloadLayout serverFunction={serverFunction} />\n }\n PayloadLayoutRoute.preload = PayloadLayout.preload\n\n // `staleReloadMode` lives on the loader *object* — router-core only reads it\n // off a non-function loader — so stale-match revalidation blocks on the fresh\n // loader instead of flashing stale layout data via the default background SWR.\n return {\n component: PayloadLayoutRoute,\n loader: {\n handler: ({ abortController }: { abortController: AbortController }) =>\n load({ signal: abortController.signal }),\n staleReloadMode: 'blocking' as const,\n },\n }\n}\n"],"names":["DocumentRoot","HeadContent","lazyRouteComponent","Scripts","useRouterState","React","PayloadAdminShell","children","documentProps","select","state","match","matches","data","loaderData","theme","languageCode","dir","highContrastMode","suppressHydrationWarning","themeSource","head","withPayloadRoot","RootShell","options","adminRoute","PayloadRootShell","isAdminRoute","s","pathname","location","startsWith","PayloadLayout","payloadLayoutRoute","load","serverFunction","PayloadLayoutRoute","preload","component","loader","handler","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qBAAO,KAACrB;0BAAmBC;;QAC7B;QAEA,qBAAO,KAACgB;sBAAWhB;;IACrB;AACF;AAQA,4FAA4F;AAC5F,sFAAsF;AACtF,MAAMyB,gBAAgB9B,mBAAmB,IAAM,MAAM,CAAC,cAAc;AAEpE;;;;CAIC,GACD,OAAO,SAAS+B,mBAAmB,EACjCC,IAAI,EACJC,cAAc,EAIf;IACC,SAASC;QACP,qBAAO,KAACJ;YAAcG,gBAAgBA;;IACxC;IACAC,mBAAmBC,OAAO,GAAGL,cAAcK,OAAO;IAElD,6EAA6E;IAC7E,8EAA8E;IAC9E,+EAA+E;IAC/E,OAAO;QACLC,WAAWF;QACXG,QAAQ;YACNC,SAAS,CAAC,EAAEC,eAAe,EAAwC,GACjEP,KAAK;oBAAEQ,QAAQD,gBAAgBC,MAAM;gBAAC;YACxCC,iBAAiB;QACnB;IACF;AACF"}
@@ -1,10 +1,6 @@
1
1
  import type { ServerFunctionClient } from 'payload';
2
2
  import React from 'react';
3
- /**
4
- * The admin layout route's component. Maps the layout loader data onto `RootProviders` and
5
- * renders the admin chrome (progress bar, custom-provider tree or router `<Outlet />`, portal
6
- * mount). `payloadLayoutRoute` loads it lazily, so front-end routes never download the admin UI.
7
- */
3
+ /** Renders the Flight layout with the app's client-local server-function dispatcher. */
8
4
  export declare function PayloadLayout({ serverFunction }: {
9
5
  serverFunction: ServerFunctionClient;
10
6
  }): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/adapters/layout/lazy.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAInD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,cAAc,EAAE,EAAE;IAAE,cAAc,EAAE,oBAAoB,CAAA;CAAE,qBAYzF"}
1
+ {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/adapters/layout/lazy.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAGnD,OAAO,KAA2B,MAAM,OAAO,CAAA;AAM/C,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,EAAE,cAAc,EAAE,EAAE;IAAE,cAAc,EAAE,oBAAoB,CAAA;CAAE,qBAKzF"}
@@ -1,22 +1,16 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { RootProviders } from '@payloadcms/ui';
4
- import { Outlet, useLoaderData } from '@tanstack/react-router';
5
- import React from 'react';
6
- import { TanStackRouterAdapter } from '../router.js';
7
- /**
8
- * The admin layout route's component. Maps the layout loader data onto `RootProviders` and
9
- * renders the admin chrome (progress bar, custom-provider tree or router `<Outlet />`, portal
10
- * mount). `payloadLayoutRoute` loads it lazily, so front-end routes never download the admin UI.
11
- */ export function PayloadLayout({ serverFunction }) {
12
- const data = useLoaderData({
3
+ import { useLoaderData } from '@tanstack/react-router';
4
+ import React, { useDeferredValue } from 'react';
5
+ import { ServerFunctionContext } from './RootProviders/index.js';
6
+ /** Renders the Flight layout with the app's client-local server-function dispatcher. */ export function PayloadLayout({ serverFunction }) {
7
+ const { layout } = useLoaderData({
13
8
  strict: false
14
9
  });
15
- return /*#__PURE__*/ _jsx(RootProviders, {
16
- data: data,
17
- RouterAdapter: TanStackRouterAdapter,
18
- serverFunction: serverFunction,
19
- children: data.providers ?? /*#__PURE__*/ _jsx(Outlet, {})
10
+ const deferredLayout = useDeferredValue(layout);
11
+ return /*#__PURE__*/ _jsx(ServerFunctionContext, {
12
+ value: serverFunction,
13
+ children: deferredLayout
20
14
  });
21
15
  }
22
16
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapters/layout/lazy.tsx"],"sourcesContent":["'use client'\nimport type { ServerFunctionClient } from 'payload'\n\nimport { RootProviders } from '@payloadcms/ui'\nimport { Outlet, useLoaderData } from '@tanstack/react-router'\nimport React from 'react'\n\nimport { TanStackRouterAdapter } from '../router.js'\n\n/**\n * The admin layout route's component. Maps the layout loader data onto `RootProviders` and\n * renders the admin chrome (progress bar, custom-provider tree or router `<Outlet />`, portal\n * mount). `payloadLayoutRoute` loads it lazily, so front-end routes never download the admin UI.\n */\nexport function PayloadLayout({ serverFunction }: { serverFunction: ServerFunctionClient }) {\n const data = useLoaderData({ strict: false })\n\n return (\n <RootProviders\n data={data}\n RouterAdapter={TanStackRouterAdapter}\n serverFunction={serverFunction}\n >\n {data.providers ?? <Outlet />}\n </RootProviders>\n )\n}\n"],"names":["RootProviders","Outlet","useLoaderData","React","TanStackRouterAdapter","PayloadLayout","serverFunction","data","strict","RouterAdapter","providers"],"mappings":"AAAA;;AAGA,SAASA,aAAa,QAAQ,iBAAgB;AAC9C,SAASC,MAAM,EAAEC,aAAa,QAAQ,yBAAwB;AAC9D,OAAOC,WAAW,QAAO;AAEzB,SAASC,qBAAqB,QAAQ,eAAc;AAEpD;;;;CAIC,GACD,OAAO,SAASC,cAAc,EAAEC,cAAc,EAA4C;IACxF,MAAMC,OAAOL,cAAc;QAAEM,QAAQ;IAAM;IAE3C,qBACE,KAACR;QACCO,MAAMA;QACNE,eAAeL;QACfE,gBAAgBA;kBAEfC,KAAKG,SAAS,kBAAI,KAACT;;AAG1B"}
1
+ {"version":3,"sources":["../../../src/adapters/layout/lazy.tsx"],"sourcesContent":["'use client'\nimport type { ServerFunctionClient } from 'payload'\n\nimport { useLoaderData } from '@tanstack/react-router'\nimport React, { useDeferredValue } from 'react'\n\nimport type { LoadLayoutDataResult } from './server.js'\n\nimport { ServerFunctionContext } from './RootProviders/index.js'\n\n/** Renders the Flight layout with the app's client-local server-function dispatcher. */\nexport function PayloadLayout({ serverFunction }: { serverFunction: ServerFunctionClient }) {\n const { layout }: LoadLayoutDataResult = useLoaderData({ strict: false })\n const deferredLayout = useDeferredValue(layout)\n\n return <ServerFunctionContext value={serverFunction}>{deferredLayout}</ServerFunctionContext>\n}\n"],"names":["useLoaderData","React","useDeferredValue","ServerFunctionContext","PayloadLayout","serverFunction","layout","strict","deferredLayout","value"],"mappings":"AAAA;;AAGA,SAASA,aAAa,QAAQ,yBAAwB;AACtD,OAAOC,SAASC,gBAAgB,QAAQ,QAAO;AAI/C,SAASC,qBAAqB,QAAQ,2BAA0B;AAEhE,sFAAsF,GACtF,OAAO,SAASC,cAAc,EAAEC,cAAc,EAA4C;IACxF,MAAM,EAAEC,MAAM,EAAE,GAAyBN,cAAc;QAAEO,QAAQ;IAAM;IACvE,MAAMC,iBAAiBN,iBAAiBI;IAExC,qBAAO,KAACH;QAAsBM,OAAOJ;kBAAiBG;;AACxD"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ /** Gives Flight a plain function identity React can match across refreshes, preserving Outlet state and focus. */
3
+ export declare function PayloadOutlet(): React.JSX.Element;
4
+ //# sourceMappingURL=outlet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outlet.d.ts","sourceRoot":"","sources":["../../../src/adapters/layout/outlet.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,kHAAkH;AAClH,wBAAgB,aAAa,sBAE5B"}
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Outlet } from '@tanstack/react-router';
4
+ import React from 'react';
5
+ /** Gives Flight a plain function identity React can match across refreshes, preserving Outlet state and focus. */ export function PayloadOutlet() {
6
+ return /*#__PURE__*/ _jsx(Outlet, {});
7
+ }
8
+
9
+ //# sourceMappingURL=outlet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/adapters/layout/outlet.tsx"],"sourcesContent":["'use client'\n\nimport { Outlet } from '@tanstack/react-router'\nimport React from 'react'\n\n/** Gives Flight a plain function identity React can match across refreshes, preserving Outlet state and focus. */\nexport function PayloadOutlet() {\n return <Outlet />\n}\n"],"names":["Outlet","React","PayloadOutlet"],"mappings":"AAAA;;AAEA,SAASA,MAAM,QAAQ,yBAAwB;AAC/C,OAAOC,WAAW,QAAO;AAEzB,gHAAgH,GAChH,OAAO,SAASC;IACd,qBAAO,KAACF;AACV"}
@@ -1,10 +1,12 @@
1
1
  import type { RootLayoutData as UIRootLayoutData } from '@payloadcms/ui/layouts/Root/getRootLayoutData';
2
+ import type { RenderableServerComponent } from '@tanstack/react-start/rsc';
2
3
  import type { ImportMap, SanitizedConfig } from 'payload';
3
- import type { ReactNode } from 'react';
4
- import type { SerializableRecord } from '../../utilities/toSerializable.js';
5
- export type LoadLayoutDataResult = SerializableRecord;
4
+ import type { ReactElement, ReactNode } from 'react';
5
+ export type LoadLayoutDataResult = {
6
+ layout: RenderableServerComponent<ReactElement>;
7
+ } & Pick<RootLayoutData, 'dir' | 'highContrastMode' | 'languageCode' | 'suppressHydrationWarning' | 'theme' | 'themeSource'>;
6
8
  export type RootLayoutData = {
7
- /** Custom admin providers wrapping the Outlet, rendered to an RSC payload before serialization. */
9
+ /** Custom admin providers wrapping the Outlet. */
8
10
  providers?: ReactNode;
9
11
  } & UIRootLayoutData;
10
12
  export type GetLayoutDataArgs = {
@@ -13,15 +15,7 @@ export type GetLayoutDataArgs = {
13
15
  };
14
16
  /** Fetches the admin layout data for the TanStack layout route loader. */
15
17
  export declare function getLayoutData({ configPromise, importMap, }: GetLayoutDataArgs): Promise<RootLayoutData>;
16
- /**
17
- * Resolves the admin layout data for TanStack Start and returns a serializable
18
- * payload for the `/_payload` route loader. The framework adapter wraps this in
19
- * a `createServerFn` that supplies the app's `config` and generated `importMap`.
20
- *
21
- * `toSerializable` strips React elements, so the custom-providers element tree
22
- * (`config.admin.components.providers`) is rendered to an RSC payload separately
23
- * and re-attached.
24
- */
18
+ /** Keeps document attributes ordinary and sends the complete layout model through Flight. */
25
19
  export declare function loadLayoutData({ config, importMap, }: {
26
20
  config: SanitizedConfig;
27
21
  importMap: ImportMap;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/adapters/layout/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,gBAAgB,EAAE,MAAM,+CAA+C,CAAA;AACvG,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAe,MAAM,SAAS,CAAA;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAK3E,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,CAAA;AAErD,MAAM,MAAM,cAAc,GAAG;IAC3B,mGAAmG;IACnG,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB,GAAG,gBAAgB,CAAA;AAEpB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IACzD,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA;AAED,0EAA0E;AAC1E,wBAAsB,aAAa,CAAC,EAClC,aAAa,EACb,SAAS,GACV,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAqC7C;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,EACnC,MAAM,EACN,SAAS,GACV,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,SAAS,EAAE,SAAS,CAAA;CACrB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAMhC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/adapters/layout/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,gBAAgB,EAAE,MAAM,+CAA+C,CAAA;AACvG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAe,MAAM,SAAS,CAAA;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAYpD,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,yBAAyB,CAAC,YAAY,CAAC,CAAA;CAChD,GAAG,IAAI,CACN,cAAc,EACd,KAAK,GAAG,kBAAkB,GAAG,cAAc,GAAG,0BAA0B,GAAG,OAAO,GAAG,aAAa,CACnG,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,kDAAkD;IAClD,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB,GAAG,gBAAgB,CAAA;AAEpB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IACzD,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA;AAED,0EAA0E;AAC1E,wBAAsB,aAAa,CAAC,EAClC,aAAa,EACb,SAAS,GACV,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAqC7C;AAED,6FAA6F;AAC7F,wBAAsB,cAAc,CAAC,EACnC,MAAM,EACN,SAAS,GACV,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,SAAS,EAAE,SAAS,CAAA;CACrB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAahC"}
@@ -1,10 +1,11 @@
1
1
  import { NestProviders } from '@payloadcms/ui/layouts/NestProviders';
2
2
  import { getRootLayoutData } from '@payloadcms/ui/layouts/Root/getRootLayoutData';
3
- import { Outlet } from '@tanstack/react-router';
4
3
  import { renderServerComponent } from '@tanstack/react-start/rsc';
5
4
  import { createElement } from 'react';
5
+ // eslint-disable-next-line payload/no-imports-from-exports-dir -- Register the client boundary in the Flight model.
6
+ import { PayloadRootProviders } from '../../exports/client/layout.js';
6
7
  import { initAdminContext } from '../../utilities/initAdminContext.server.js';
7
- import { toSerializable } from '../../utilities/toSerializable.js';
8
+ import { PayloadOutlet } from './outlet.js';
8
9
  /** Fetches the admin layout data for the TanStack layout route loader. */ export async function getLayoutData({ configPromise, importMap }) {
9
10
  const context = await initAdminContext({
10
11
  configPromise,
@@ -31,7 +32,7 @@ import { toSerializable } from '../../utilities/toSerializable.js';
31
32
  user: user ?? undefined
32
33
  };
33
34
  providers = createElement(NestProviders, {
34
- children: createElement(Outlet),
35
+ children: createElement(PayloadOutlet),
35
36
  importMap,
36
37
  providers: providerPaths,
37
38
  serverProps
@@ -42,22 +43,23 @@ import { toSerializable } from '../../utilities/toSerializable.js';
42
43
  providers
43
44
  };
44
45
  }
45
- /**
46
- * Resolves the admin layout data for TanStack Start and returns a serializable
47
- * payload for the `/_payload` route loader. The framework adapter wraps this in
48
- * a `createServerFn` that supplies the app's `config` and generated `importMap`.
49
- *
50
- * `toSerializable` strips React elements, so the custom-providers element tree
51
- * (`config.admin.components.providers`) is rendered to an RSC payload separately
52
- * and re-attached.
53
- */ export async function loadLayoutData({ config, importMap }) {
54
- const { providers, ...data } = await getLayoutData({
46
+ /** Keeps document attributes ordinary and sends the complete layout model through Flight. */ export async function loadLayoutData({ config, importMap }) {
47
+ const data = await getLayoutData({
55
48
  configPromise: config,
56
49
  importMap
57
50
  });
58
- return toSerializable(data, {
59
- providers: providers ? await renderServerComponent(providers) : undefined
60
- });
51
+ const { dir, highContrastMode, languageCode, suppressHydrationWarning, theme, themeSource } = data;
52
+ return {
53
+ dir,
54
+ highContrastMode,
55
+ languageCode,
56
+ layout: await renderServerComponent(createElement(PayloadRootProviders, {
57
+ data
58
+ })),
59
+ suppressHydrationWarning,
60
+ theme,
61
+ themeSource
62
+ };
61
63
  }
62
64
 
63
65
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapters/layout/server.ts"],"sourcesContent":["import type { RootLayoutData as UIRootLayoutData } from '@payloadcms/ui/layouts/Root/getRootLayoutData'\nimport type { ImportMap, SanitizedConfig, ServerProps } from 'payload'\nimport type { ReactNode } from 'react'\n\nimport { NestProviders } from '@payloadcms/ui/layouts/NestProviders'\nimport { getRootLayoutData } from '@payloadcms/ui/layouts/Root/getRootLayoutData'\nimport { Outlet } from '@tanstack/react-router'\nimport { renderServerComponent } from '@tanstack/react-start/rsc'\nimport { createElement } from 'react'\n\nimport type { SerializableRecord } from '../../utilities/toSerializable.js'\n\nimport { initAdminContext } from '../../utilities/initAdminContext.server.js'\nimport { toSerializable } from '../../utilities/toSerializable.js'\n\nexport type LoadLayoutDataResult = SerializableRecord\n\nexport type RootLayoutData = {\n /** Custom admin providers wrapping the Outlet, rendered to an RSC payload before serialization. */\n providers?: ReactNode\n} & UIRootLayoutData\n\nexport type GetLayoutDataArgs = {\n configPromise: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n}\n\n/** Fetches the admin layout data for the TanStack layout route loader. */\nexport async function getLayoutData({\n configPromise,\n importMap,\n}: GetLayoutDataArgs): Promise<RootLayoutData> {\n const context = await initAdminContext({ configPromise, importMap })\n\n const { cookies, permissions, req, user } = context\n\n const data = await getRootLayoutData({\n cookies,\n importMap,\n permissions,\n req,\n user,\n })\n\n const providerPaths = req.payload.config.admin?.components?.providers\n\n let providers: ReactNode\n\n if (Array.isArray(providerPaths) && providerPaths.length > 0) {\n const serverProps: ServerProps = {\n i18n: req.i18n,\n params: {},\n payload: req.payload,\n permissions,\n searchParams: {},\n server: req.server!,\n user: user ?? undefined,\n }\n\n providers = createElement(NestProviders, {\n children: createElement(Outlet),\n importMap,\n providers: providerPaths,\n serverProps,\n })\n }\n\n return { ...data, providers }\n}\n\n/**\n * Resolves the admin layout data for TanStack Start and returns a serializable\n * payload for the `/_payload` route loader. The framework adapter wraps this in\n * a `createServerFn` that supplies the app's `config` and generated `importMap`.\n *\n * `toSerializable` strips React elements, so the custom-providers element tree\n * (`config.admin.components.providers`) is rendered to an RSC payload separately\n * and re-attached.\n */\nexport async function loadLayoutData({\n config,\n importMap,\n}: {\n config: SanitizedConfig\n importMap: ImportMap\n}): Promise<LoadLayoutDataResult> {\n const { providers, ...data } = await getLayoutData({ configPromise: config, importMap })\n\n return toSerializable(data, {\n providers: providers ? await renderServerComponent(providers as any) : undefined,\n })\n}\n"],"names":["NestProviders","getRootLayoutData","Outlet","renderServerComponent","createElement","initAdminContext","toSerializable","getLayoutData","configPromise","importMap","context","cookies","permissions","req","user","data","providerPaths","payload","config","admin","components","providers","Array","isArray","length","serverProps","i18n","params","searchParams","server","undefined","children","loadLayoutData"],"mappings":"AAIA,SAASA,aAAa,QAAQ,uCAAsC;AACpE,SAASC,iBAAiB,QAAQ,gDAA+C;AACjF,SAASC,MAAM,QAAQ,yBAAwB;AAC/C,SAASC,qBAAqB,QAAQ,4BAA2B;AACjE,SAASC,aAAa,QAAQ,QAAO;AAIrC,SAASC,gBAAgB,QAAQ,6CAA4C;AAC7E,SAASC,cAAc,QAAQ,oCAAmC;AAclE,wEAAwE,GACxE,OAAO,eAAeC,cAAc,EAClCC,aAAa,EACbC,SAAS,EACS;IAClB,MAAMC,UAAU,MAAML,iBAAiB;QAAEG;QAAeC;IAAU;IAElE,MAAM,EAAEE,OAAO,EAAEC,WAAW,EAAEC,GAAG,EAAEC,IAAI,EAAE,GAAGJ;IAE5C,MAAMK,OAAO,MAAMd,kBAAkB;QACnCU;QACAF;QACAG;QACAC;QACAC;IACF;IAEA,MAAME,gBAAgBH,IAAII,OAAO,CAACC,MAAM,CAACC,KAAK,EAAEC,YAAYC;IAE5D,IAAIA;IAEJ,IAAIC,MAAMC,OAAO,CAACP,kBAAkBA,cAAcQ,MAAM,GAAG,GAAG;QAC5D,MAAMC,cAA2B;YAC/BC,MAAMb,IAAIa,IAAI;YACdC,QAAQ,CAAC;YACTV,SAASJ,IAAII,OAAO;YACpBL;YACAgB,cAAc,CAAC;YACfC,QAAQhB,IAAIgB,MAAM;YAClBf,MAAMA,QAAQgB;QAChB;QAEAT,YAAYjB,cAAcJ,eAAe;YACvC+B,UAAU3B,cAAcF;YACxBO;YACAY,WAAWL;YACXS;QACF;IACF;IAEA,OAAO;QAAE,GAAGV,IAAI;QAAEM;IAAU;AAC9B;AAEA;;;;;;;;CAQC,GACD,OAAO,eAAeW,eAAe,EACnCd,MAAM,EACNT,SAAS,EAIV;IACC,MAAM,EAAEY,SAAS,EAAE,GAAGN,MAAM,GAAG,MAAMR,cAAc;QAAEC,eAAeU;QAAQT;IAAU;IAEtF,OAAOH,eAAeS,MAAM;QAC1BM,WAAWA,YAAY,MAAMlB,sBAAsBkB,aAAoBS;IACzE;AACF"}
1
+ {"version":3,"sources":["../../../src/adapters/layout/server.ts"],"sourcesContent":["import type { RootLayoutData as UIRootLayoutData } from '@payloadcms/ui/layouts/Root/getRootLayoutData'\nimport type { RenderableServerComponent } from '@tanstack/react-start/rsc'\nimport type { ImportMap, SanitizedConfig, ServerProps } from 'payload'\nimport type { ReactElement, ReactNode } from 'react'\n\nimport { NestProviders } from '@payloadcms/ui/layouts/NestProviders'\nimport { getRootLayoutData } from '@payloadcms/ui/layouts/Root/getRootLayoutData'\nimport { renderServerComponent } from '@tanstack/react-start/rsc'\nimport { createElement } from 'react'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir -- Register the client boundary in the Flight model.\nimport { PayloadRootProviders } from '../../exports/client/layout.js'\nimport { initAdminContext } from '../../utilities/initAdminContext.server.js'\nimport { PayloadOutlet } from './outlet.js'\n\nexport type LoadLayoutDataResult = {\n layout: RenderableServerComponent<ReactElement>\n} & Pick<\n RootLayoutData,\n 'dir' | 'highContrastMode' | 'languageCode' | 'suppressHydrationWarning' | 'theme' | 'themeSource'\n>\n\nexport type RootLayoutData = {\n /** Custom admin providers wrapping the Outlet. */\n providers?: ReactNode\n} & UIRootLayoutData\n\nexport type GetLayoutDataArgs = {\n configPromise: Promise<SanitizedConfig> | SanitizedConfig\n importMap: ImportMap\n}\n\n/** Fetches the admin layout data for the TanStack layout route loader. */\nexport async function getLayoutData({\n configPromise,\n importMap,\n}: GetLayoutDataArgs): Promise<RootLayoutData> {\n const context = await initAdminContext({ configPromise, importMap })\n\n const { cookies, permissions, req, user } = context\n\n const data = await getRootLayoutData({\n cookies,\n importMap,\n permissions,\n req,\n user,\n })\n\n const providerPaths = req.payload.config.admin?.components?.providers\n\n let providers: ReactNode\n\n if (Array.isArray(providerPaths) && providerPaths.length > 0) {\n const serverProps: ServerProps = {\n i18n: req.i18n,\n params: {},\n payload: req.payload,\n permissions,\n searchParams: {},\n server: req.server!,\n user: user ?? undefined,\n }\n\n providers = createElement(NestProviders, {\n children: createElement(PayloadOutlet),\n importMap,\n providers: providerPaths,\n serverProps,\n })\n }\n\n return { ...data, providers }\n}\n\n/** Keeps document attributes ordinary and sends the complete layout model through Flight. */\nexport async function loadLayoutData({\n config,\n importMap,\n}: {\n config: SanitizedConfig\n importMap: ImportMap\n}): Promise<LoadLayoutDataResult> {\n const data = await getLayoutData({ configPromise: config, importMap })\n const { dir, highContrastMode, languageCode, suppressHydrationWarning, theme, themeSource } = data\n\n return {\n dir,\n highContrastMode,\n languageCode,\n layout: await renderServerComponent(createElement(PayloadRootProviders, { data })),\n suppressHydrationWarning,\n theme,\n themeSource,\n }\n}\n"],"names":["NestProviders","getRootLayoutData","renderServerComponent","createElement","PayloadRootProviders","initAdminContext","PayloadOutlet","getLayoutData","configPromise","importMap","context","cookies","permissions","req","user","data","providerPaths","payload","config","admin","components","providers","Array","isArray","length","serverProps","i18n","params","searchParams","server","undefined","children","loadLayoutData","dir","highContrastMode","languageCode","suppressHydrationWarning","theme","themeSource","layout"],"mappings":"AAKA,SAASA,aAAa,QAAQ,uCAAsC;AACpE,SAASC,iBAAiB,QAAQ,gDAA+C;AACjF,SAASC,qBAAqB,QAAQ,4BAA2B;AACjE,SAASC,aAAa,QAAQ,QAAO;AAErC,oHAAoH;AACpH,SAASC,oBAAoB,QAAQ,iCAAgC;AACrE,SAASC,gBAAgB,QAAQ,6CAA4C;AAC7E,SAASC,aAAa,QAAQ,cAAa;AAmB3C,wEAAwE,GACxE,OAAO,eAAeC,cAAc,EAClCC,aAAa,EACbC,SAAS,EACS;IAClB,MAAMC,UAAU,MAAML,iBAAiB;QAAEG;QAAeC;IAAU;IAElE,MAAM,EAAEE,OAAO,EAAEC,WAAW,EAAEC,GAAG,EAAEC,IAAI,EAAE,GAAGJ;IAE5C,MAAMK,OAAO,MAAMd,kBAAkB;QACnCU;QACAF;QACAG;QACAC;QACAC;IACF;IAEA,MAAME,gBAAgBH,IAAII,OAAO,CAACC,MAAM,CAACC,KAAK,EAAEC,YAAYC;IAE5D,IAAIA;IAEJ,IAAIC,MAAMC,OAAO,CAACP,kBAAkBA,cAAcQ,MAAM,GAAG,GAAG;QAC5D,MAAMC,cAA2B;YAC/BC,MAAMb,IAAIa,IAAI;YACdC,QAAQ,CAAC;YACTV,SAASJ,IAAII,OAAO;YACpBL;YACAgB,cAAc,CAAC;YACfC,QAAQhB,IAAIgB,MAAM;YAClBf,MAAMA,QAAQgB;QAChB;QAEAT,YAAYlB,cAAcH,eAAe;YACvC+B,UAAU5B,cAAcG;YACxBG;YACAY,WAAWL;YACXS;QACF;IACF;IAEA,OAAO;QAAE,GAAGV,IAAI;QAAEM;IAAU;AAC9B;AAEA,2FAA2F,GAC3F,OAAO,eAAeW,eAAe,EACnCd,MAAM,EACNT,SAAS,EAIV;IACC,MAAMM,OAAO,MAAMR,cAAc;QAAEC,eAAeU;QAAQT;IAAU;IACpE,MAAM,EAAEwB,GAAG,EAAEC,gBAAgB,EAAEC,YAAY,EAAEC,wBAAwB,EAAEC,KAAK,EAAEC,WAAW,EAAE,GAAGvB;IAE9F,OAAO;QACLkB;QACAC;QACAC;QACAI,QAAQ,MAAMrC,sBAAsBC,cAAcC,sBAAsB;YAAEW;QAAK;QAC/EqB;QACAC;QACAC;IACF;AACF"}
@@ -8,6 +8,7 @@ export type AdminLoad = (opts: {
8
8
  _splat: string;
9
9
  search: Record<string, string | string[]>;
10
10
  };
11
+ signal?: AbortSignal;
11
12
  }) => Promise<any>;
12
13
  /**
13
14
  * Route options for the admin splat route (`/_payload/admin/$`). Renders Payload's
@@ -43,7 +44,8 @@ export declare function payloadAdminSplatRoute({ load }: {
43
44
  };
44
45
  notFoundComponent: import("@tanstack/react-router").AsyncRouteComponent<import("@tanstack/react-router").NotFoundRouteProps>;
45
46
  loader: {
46
- handler: ({ location, params }: {
47
+ handler: ({ abortController, location, params, }: {
48
+ abortController: AbortController;
47
49
  location: any;
48
50
  params: any;
49
51
  }) => Promise<any>;
@@ -88,7 +90,8 @@ export declare function payloadAdminIndexRoute({ load }: {
88
90
  };
89
91
  notFoundComponent: import("@tanstack/react-router").AsyncRouteComponent<import("@tanstack/react-router").NotFoundRouteProps>;
90
92
  loader: {
91
- handler: ({ location, params }: {
93
+ handler: ({ abortController, location, params, }: {
94
+ abortController: AbortController;
92
95
  location: any;
93
96
  params: any;
94
97
  }) => Promise<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/views/index.tsx"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE;IAC7B,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;KAAE,CAAA;CACpE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;AAkElB;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE;;2BArC3C;QAAE,UAAU,CAAC,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;QAUzC,OAAO,yBAA+B;YAAE,QAAQ,EAAE,GAAG,CAAC;YAAC,MAAM,EAAE,GAAG,CAAA;SAAE;QAYpE,eAAe,EAAE,UAAU;;6BAGJ;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;QAC1D,SAAS;;6BAEc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EAejD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,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;AACH,wBAAgB,sBAAsB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE;;2BA9D3C;QAAE,UAAU,CAAC,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;QAUzC,OAAO,2CAIJ;YACD,eAAe,EAAE,eAAe,CAAA;YAChC,QAAQ,EAAE,GAAG,CAAA;YACb,MAAM,EAAE,GAAG,CAAA;SACZ;QAiBD,eAAe,EAAE,UAAU;;6BAGJ;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;QAC1D,SAAS;;6BAEc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EA2BjD"}
@@ -2,12 +2,13 @@
2
2
  import { lazyRouteComponent, notFound, redirect } from '@tanstack/react-router';
3
3
  import { getAdminMeta } from '../metadata.js';
4
4
  const searchToRecord = (searchStr)=>Object.fromEntries(new URLSearchParams(searchStr));
5
- const runLoader = async (load, splat, searchStr)=>{
5
+ const runLoader = async ({ load, searchStr, signal, splat })=>{
6
6
  const data = await load({
7
7
  data: {
8
8
  _splat: splat,
9
9
  search: searchToRecord(searchStr)
10
- }
10
+ },
11
+ signal
11
12
  });
12
13
  if (data?._redirect) {
13
14
  // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing redirect objects
@@ -33,8 +34,13 @@ const adminRouteOptions = ({ forwardNotFoundPayload, load, resolveSplat })=>({
33
34
  // instead of the default background SWR that flashes the pre-navigation list
34
35
  // (e.g. a just-created doc missing) until the reload lands.
35
36
  loader: {
36
- handler: async ({ location, params })=>{
37
- const data = await runLoader(load, resolveSplat(params), location.searchStr);
37
+ handler: async ({ abortController, location, params })=>{
38
+ const data = await runLoader({
39
+ load,
40
+ searchStr: location.searchStr,
41
+ signal: abortController.signal,
42
+ splat: resolveSplat(params)
43
+ });
38
44
  if (data?._notFound) {
39
45
  // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects
40
46
  throw notFound(forwardNotFoundPayload ? {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapters/views/index.tsx"],"sourcesContent":["'use client'\n\nimport { lazyRouteComponent, notFound, redirect } from '@tanstack/react-router'\n\nimport { getAdminMeta } from '../metadata.js'\n\n/**\n * Loader supplied by the app — a TanStack Start `createServerFn` that delegates\n * to `loadAdminPage`. Typed loosely because the server-fn's call signature is\n * generated by the Start compiler.\n */\nexport type AdminLoad = (opts: {\n data: { _splat: string; search: Record<string, string | string[]> }\n}) => Promise<any>\n\nconst searchToRecord = (searchStr: string): Record<string, string | string[]> =>\n Object.fromEntries(new URLSearchParams(searchStr)) as Record<string, string | string[]>\n\nconst runLoader = async (load: AdminLoad, splat: string, searchStr: string) => {\n const data = await load({ data: { _splat: splat, search: searchToRecord(searchStr) } })\n if (data?._redirect) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing redirect objects\n throw redirect({ to: data._redirect })\n }\n return data\n}\n\n// The admin UI loads with the admin routes only, so front-end routes never download it. The\n// router preloads lazy route components before rendering, so admin pages don't flash.\nconst AdminPage = lazyRouteComponent(() => import('./lazy.js'), 'AdminPage')\nconst AdminNotFound = lazyRouteComponent(() => import('./lazy.js'), 'AdminNotFound')\n\nconst adminRouteOptions = ({\n forwardNotFoundPayload,\n load,\n resolveSplat,\n}: {\n /**\n * Ships the server-rendered NotFound tree through `notFound()`'s `data` so a\n * `notFoundComponent` can render it with the full admin chrome. Routes without\n * one throw bare.\n */\n forwardNotFoundPayload: boolean\n load: AdminLoad\n /** The route's splat, i.e. the path after `/admin/`. */\n resolveSplat: (params: any) => string\n}) => ({\n component: AdminPage,\n head: ({ loaderData }: { loaderData?: any }) => getAdminMeta(loaderData?.metadata),\n // Both admin routes must use the same boundary type so index ↔ splat\n // navigation preserves the existing admin subtree.\n notFoundComponent: AdminNotFound,\n // `staleReloadMode: 'blocking'` (a property of the loader *object*, not a\n // sibling route option — router-core only reads it off a non-function loader)\n // makes stale-match revalidation await the fresh loader before committing,\n // instead of the default background SWR that flashes the pre-navigation list\n // (e.g. a just-created doc missing) until the reload lands.\n loader: {\n handler: async ({ location, params }: { location: any; params: any }) => {\n const data = await runLoader(load, resolveSplat(params), location.searchStr)\n if (data?._notFound) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects\n throw notFound(\n forwardNotFoundPayload\n ? { data: { routeKey: data.routeKey, rscPayload: data.rscPayload } }\n : undefined,\n )\n }\n return data\n },\n staleReloadMode: 'blocking' as const,\n },\n // Surface query params in `loaderDeps` so `?locale=es` re-runs the loader.\n loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n searchKey: JSON.stringify(search),\n }),\n validateSearch: (search: Record<string, unknown>) => search,\n})\n\n/**\n * Route options for the admin splat route (`/_payload/admin/$`). Renders Payload's\n * server-built NotFound page (shipped via the `notFound()` error's\n * `data.rscPayload`) for unknown/access-denied routes, falling back to the bare\n * client view.\n */\nexport function payloadAdminSplatRoute({ load }: { load: AdminLoad }) {\n return adminRouteOptions({\n forwardNotFoundPayload: true,\n load,\n resolveSplat: (params) => params._splat ?? '',\n })\n}\n\n/**\n * Route options for the admin index route (`/_payload/admin/`). Not-found\n * results omit the RSC payload and fall back to `NotFoundClient`.\n */\nexport function payloadAdminIndexRoute({ load }: { load: AdminLoad }) {\n return adminRouteOptions({\n forwardNotFoundPayload: false,\n load,\n resolveSplat: () => '',\n })\n}\n"],"names":["lazyRouteComponent","notFound","redirect","getAdminMeta","searchToRecord","searchStr","Object","fromEntries","URLSearchParams","runLoader","load","splat","data","_splat","search","_redirect","to","AdminPage","AdminNotFound","adminRouteOptions","forwardNotFoundPayload","resolveSplat","component","head","loaderData","metadata","notFoundComponent","loader","handler","location","params","_notFound","routeKey","rscPayload","undefined","staleReloadMode","loaderDeps","searchKey","JSON","stringify","validateSearch","payloadAdminSplatRoute","payloadAdminIndexRoute"],"mappings":"AAAA;AAEA,SAASA,kBA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C,EAAEtB,MAAM,EAAuC,GAAM,CAAA;gBAChEuB,WAAWC,KAAKC,SAAS,CAACzB;YAC5B,CAAA;QACA0B,gBAAgB,CAAC1B,SAAoCA;IACvD,CAAA;AAEA;;;;;CAKC,GACD,OAAO,SAAS2B,uBAAuB,EAAE/B,IAAI,EAAuB;IAClE,OAAOS,kBAAkB;QACvBC,wBAAwB;QACxBV;QACAW,cAAc,CAACS,SAAWA,OAAOjB,MAAM,IAAI;IAC7C;AACF;AAEA;;;CAGC,GACD,OAAO,SAAS6B,uBAAuB,EAAEhC,IAAI,EAAuB;IAClE,OAAOS,kBAAkB;QACvBC,wBAAwB;QACxBV;QACAW,cAAc,IAAM;IACtB;AACF"}
1
+ {"version":3,"sources":["../../../src/adapters/views/index.tsx"],"sourcesContent":["'use client'\n\nimport { lazyRouteComponent, notFound, redirect } from '@tanstack/react-router'\n\nimport { getAdminMeta } from '../metadata.js'\n\n/**\n * Loader supplied by the app — a TanStack Start `createServerFn` that delegates\n * to `loadAdminPage`. Typed loosely because the server-fn's call signature is\n * generated by the Start compiler.\n */\nexport type AdminLoad = (opts: {\n data: { _splat: string; search: Record<string, string | string[]> }\n signal?: AbortSignal\n}) => Promise<any>\n\nconst searchToRecord = (searchStr: string): Record<string, string | string[]> =>\n Object.fromEntries(new URLSearchParams(searchStr)) as Record<string, string | string[]>\n\nconst runLoader = async ({\n load,\n searchStr,\n signal,\n splat,\n}: {\n load: AdminLoad\n searchStr: string\n signal: AbortSignal\n splat: string\n}) => {\n const data = await load({ data: { _splat: splat, search: searchToRecord(searchStr) }, signal })\n if (data?._redirect) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing redirect objects\n throw redirect({ to: data._redirect })\n }\n return data\n}\n\n// The admin UI loads with the admin routes only, so front-end routes never download it. The\n// router preloads lazy route components before rendering, so admin pages don't flash.\nconst AdminPage = lazyRouteComponent(() => import('./lazy.js'), 'AdminPage')\nconst AdminNotFound = lazyRouteComponent(() => import('./lazy.js'), 'AdminNotFound')\n\nconst adminRouteOptions = ({\n forwardNotFoundPayload,\n load,\n resolveSplat,\n}: {\n /**\n * Ships the server-rendered NotFound tree through `notFound()`'s `data` so a\n * `notFoundComponent` can render it with the full admin chrome. Routes without\n * one throw bare.\n */\n forwardNotFoundPayload: boolean\n load: AdminLoad\n /** The route's splat, i.e. the path after `/admin/`. */\n resolveSplat: (params: any) => string\n}) => ({\n component: AdminPage,\n head: ({ loaderData }: { loaderData?: any }) => getAdminMeta(loaderData?.metadata),\n // Both admin routes must use the same boundary type so index ↔ splat\n // navigation preserves the existing admin subtree.\n notFoundComponent: AdminNotFound,\n // `staleReloadMode: 'blocking'` (a property of the loader *object*, not a\n // sibling route option — router-core only reads it off a non-function loader)\n // makes stale-match revalidation await the fresh loader before committing,\n // instead of the default background SWR that flashes the pre-navigation list\n // (e.g. a just-created doc missing) until the reload lands.\n loader: {\n handler: async ({\n abortController,\n location,\n params,\n }: {\n abortController: AbortController\n location: any\n params: any\n }) => {\n const data = await runLoader({\n load,\n searchStr: location.searchStr,\n signal: abortController.signal,\n splat: resolveSplat(params),\n })\n if (data?._notFound) {\n // eslint-disable-next-line @typescript-eslint/only-throw-error -- TanStack Router requires throwing notFound objects\n throw notFound(\n forwardNotFoundPayload\n ? { data: { routeKey: data.routeKey, rscPayload: data.rscPayload } }\n : undefined,\n )\n }\n return data\n },\n staleReloadMode: 'blocking' as const,\n },\n // Surface query params in `loaderDeps` so `?locale=es` re-runs the loader.\n loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n searchKey: JSON.stringify(search),\n }),\n validateSearch: (search: Record<string, unknown>) => search,\n})\n\n/**\n * Route options for the admin splat route (`/_payload/admin/$`). Renders Payload's\n * server-built NotFound page (shipped via the `notFound()` error's\n * `data.rscPayload`) for unknown/access-denied routes, falling back to the bare\n * client view.\n */\nexport function payloadAdminSplatRoute({ load }: { load: AdminLoad }) {\n return adminRouteOptions({\n forwardNotFoundPayload: true,\n load,\n resolveSplat: (params) => params._splat ?? '',\n })\n}\n\n/**\n * Route options for the admin index route (`/_payload/admin/`). Not-found\n * results omit the RSC payload and fall back to `NotFoundClient`.\n */\nexport function payloadAdminIndexRoute({ load }: { load: AdminLoad }) {\n return adminRouteOptions({\n forwardNotFoundPayload: false,\n load,\n resolveSplat: () => '',\n })\n}\n"],"names":["lazyRouteComponent","notFound","redirect","getAdminMeta","searchToRecord","searchStr","Object","fromEntries","URLSearchParams","runLoader","load","signal","splat","data","_splat","search","_redirect","to","AdminPage","AdminNotFound","adminRouteOptions","forwardNotFoundPayload","resolveSplat","component","head","loaderData","metadata","notFoundComponent","loader","handler","abortController","location","params","_notFound","routeKey","rscPayload","undefined","staleReloadMode","loaderDeps","searchKey","JSON","stringify","validateSearch","payloadAdminSplatRoute","payloadAdminIndexRoute"],"mappings":"AAAA;AAEA,SAASA,kBAAkB,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,yBAAwB;AAE/E,SAASC,YAAY,QAAQ,iBAAgB;AAY7C,MAAMC,iBAAiB,CAACC,YACtBC,OAAOC,WAAW,CAAC,IAAIC,gBAAgBH;AAEzC,MAAMI,YAAY,OAAO,EACvBC,IAAI,EACJL,SAAS,EACTM,MAAM,EACNC,KAAK,EAMN;IACC,MAAMC,OAAO,MAAMH,KAAK;QAAEG,MAAM;YAAEC,QAAQF;YAAOG,QAAQX,eAAeC;QAAW;QAAGM;IAAO;IAC7F,IAAIE,MAAMG,WAAW;QACnB,qHAAqH;QACrH,MAAMd,SAAS;YAAEe,IAAIJ,KAAKG,SAAS;QAAC;IACtC;IACA,OAAOH;AACT;AAEA,4FAA4F;AAC5F,sFAAsF;AACtF,MAAMK,YAAYlB,mBAAmB,IAAM,MAAM,CAAC,cAAc;AAChE,MAAMmB,gBAAgBnB,mBAAmB,IAAM,MAAM,CAAC,cAAc;AAEpE,MAAMoB,oBAAoB,CAAC,EACzBC,sBAAsB,EACtBX,IAAI,EACJY,YAAY,EAWb,GAAM,CAAA;QACLC,WAAWL;QACXM,MAAM,CAAC,EAAEC,UAAU,EAAwB,GAAKtB,aAAasB,YAAYC;QACzE,qEAAqE;QACrE,mDAAmD;QACnDC,mBAAmBR;QACnB,0EAA0E;QAC1E,8EAA8E;QAC9E,2EAA2E;QAC3E,6EAA6E;QAC7E,4DAA4D;QAC5DS,QAAQ;YACNC,SAAS,OAAO,EACdC,eAAe,EACfC,QAAQ,EACRC,MAAM,EAKP;gBACC,MAAMnB,OAAO,MAAMJ,UAAU;oBAC3BC;oBACAL,WAAW0B,SAAS1B,SAAS;oBAC7BM,QAAQmB,gBAAgBnB,MAAM;oBAC9BC,OAAOU,aAAaU;gBACtB;gBACA,IAAInB,MAAMoB,WAAW;oBACnB,qHAAqH;oBACrH,MAAMhC,SACJoB,yBACI;wBAAER,MAAM;4BAAEqB,UAAUrB,KAAKqB,QAAQ;4BAAEC,YAAYtB,KAAKsB,UAAU;wBAAC;oBAAE,IACjEC;gBAER;gBACA,OAAOvB;YACT;YACAwB,iBAAiB;QACnB;QACA,2EAA2E;QAC3EC,YAAY,CAAC,EAAEvB,MAAM,EAAuC,GAAM,CAAA;gBAChEwB,WAAWC,KAAKC,SAAS,CAAC1B;YAC5B,CAAA;QACA2B,gBAAgB,CAAC3B,SAAoCA;IACvD,CAAA;AAEA;;;;;CAKC,GACD,OAAO,SAAS4B,uBAAuB,EAAEjC,IAAI,EAAuB;IAClE,OAAOU,kBAAkB;QACvBC,wBAAwB;QACxBX;QACAY,cAAc,CAACU,SAAWA,OAAOlB,MAAM,IAAI;IAC7C;AACF;AAEA;;;CAGC,GACD,OAAO,SAAS8B,uBAAuB,EAAElC,IAAI,EAAuB;IAClE,OAAOU,kBAAkB;QACvBC,wBAAwB;QACxBX;QACAY,cAAc,IAAM;IACtB;AACF"}
@@ -26,7 +26,7 @@ export function AdminPage() {
26
26
  isRscPayloadDeferred
27
27
  ]);
28
28
  return /*#__PURE__*/ _jsx(Fragment, {
29
- children: rscPayload
29
+ children: rscPayload?.page
30
30
  });
31
31
  }
32
32
  export function AdminNotFound({ data }) {
@@ -36,7 +36,7 @@ export function AdminNotFound({ data }) {
36
36
  return /*#__PURE__*/ _jsx(NotFoundClient, {});
37
37
  }
38
38
  return /*#__PURE__*/ _jsx(Fragment, {
39
- children: rscPayload
39
+ children: rscPayload.page
40
40
  }, routeKey);
41
41
  }
42
42
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapters/views/lazy.tsx"],"sourcesContent":["'use client'\n\nimport type { NotFoundRouteProps } from '@tanstack/react-router'\n\nimport { NotFoundClient, useRouteTransition } from '@payloadcms/ui'\nimport { useLoaderData } from '@tanstack/react-router'\nimport { Fragment, type ReactNode, useDeferredValue, useEffect } from 'react'\n\nexport function AdminPage() {\n // Note: React key intentionally omitted here so the persistent template (nav, header) doesn't remount and flash on navigation.\n // The per-route view key is attached server-side to the view subtree instead, via `renderRoot`'s `key` in `loadAdminPage`.\n const data = useLoaderData({ strict: false })\n\n // Route state comes from an external store, so a new RSC payload that suspends\n // on code-split client references can reveal the router's null fallback.\n // Keep the current payload painted until the next one is renderable.\n const rscPayload = useDeferredValue(data?.rscPayload)\n const { holdRouteTransition } = useRouteTransition()\n const isRscPayloadDeferred = rscPayload !== data?.rscPayload\n\n useEffect(() => {\n if (!isRscPayloadDeferred) {\n return\n }\n\n const releaseRouteTransition = holdRouteTransition()\n\n return () => releaseRouteTransition()\n }, [holdRouteTransition, isRscPayloadDeferred])\n\n return <Fragment>{rscPayload}</Fragment>\n}\n\ntype AdminNotFoundData = { routeKey?: string; rscPayload?: ReactNode }\n\nexport function AdminNotFound({ data }: NotFoundRouteProps) {\n // TanStack exposes not-found data as unknown; this route only receives the shape thrown below.\n const { routeKey, rscPayload } = (data ?? {}) as AdminNotFoundData\n if (!rscPayload) {\n return <NotFoundClient />\n }\n return <Fragment key={routeKey}>{rscPayload}</Fragment>\n}\n"],"names":["NotFoundClient","useRouteTransition","useLoaderData","Fragment","useDeferredValue","useEffect","AdminPage","data","strict","rscPayload","holdRouteTransition","isRscPayloadDeferred","releaseRouteTransition","AdminNotFound","routeKey"],"mappings":"AAAA;;AAIA,SAASA,cAAc,EAAEC,kBAAkB,QAAQ,iBAAgB;AACnE,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,QAAQ,EAAkBC,gBAAgB,EAAEC,SAAS,QAAQ,QAAO;AAE7E,OAAO,SAASC;IACd,+HAA+H;IAC/H,2HAA2H;IAC3H,MAAMC,OAAOL,cAAc;QAAEM,QAAQ;IAAM;IAE3C,+EAA+E;IAC/E,yEAAyE;IACzE,qEAAqE;IACrE,MAAMC,aAAaL,iBAAiBG,MAAME;IAC1C,MAAM,EAAEC,mBAAmB,EAAE,GAAGT;IAChC,MAAMU,uBAAuBF,eAAeF,MAAME;IAElDJ,UAAU;QACR,IAAI,CAACM,sBAAsB;YACzB;QACF;QAEA,MAAMC,yBAAyBF;QAE/B,OAAO,IAAME;IACf,GAAG;QAACF;QAAqBC;KAAqB;IAE9C,qBAAO,KAACR;kBAAUM;;AACpB;AAIA,OAAO,SAASI,cAAc,EAAEN,IAAI,EAAsB;IACxD,+FAA+F;IAC/F,MAAM,EAAEO,QAAQ,EAAEL,UAAU,EAAE,GAAIF,QAAQ,CAAC;IAC3C,IAAI,CAACE,YAAY;QACf,qBAAO,KAACT;IACV;IACA,qBAAO,KAACG;kBAAyBM;OAAXK;AACxB"}
1
+ {"version":3,"sources":["../../../src/adapters/views/lazy.tsx"],"sourcesContent":["'use client'\n\nimport type { NotFoundRouteProps } from '@tanstack/react-router'\n\nimport { NotFoundClient, useRouteTransition } from '@payloadcms/ui'\nimport { useLoaderData } from '@tanstack/react-router'\nimport { Fragment, useDeferredValue, useEffect } from 'react'\n\nexport function AdminPage() {\n // Note: React key intentionally omitted here so the persistent template (nav, header) doesn't remount and flash on navigation.\n // The per-route view key is attached server-side to the view subtree instead, via `renderRoot`'s `key` in `loadAdminPage`.\n const data = useLoaderData({ strict: false })\n\n // Route state comes from an external store, so a new RSC payload that suspends\n // on code-split client references can reveal the router's null fallback.\n // Keep the current payload painted until the next one is renderable.\n const rscPayload = useDeferredValue(data?.rscPayload)\n const { holdRouteTransition } = useRouteTransition()\n const isRscPayloadDeferred = rscPayload !== data?.rscPayload\n\n useEffect(() => {\n if (!isRscPayloadDeferred) {\n return\n }\n\n const releaseRouteTransition = holdRouteTransition()\n\n return () => releaseRouteTransition()\n }, [holdRouteTransition, isRscPayloadDeferred])\n\n return <Fragment>{rscPayload?.page}</Fragment>\n}\n\ntype AdminNotFoundData = { routeKey?: string; rscPayload?: { page: React.ReactNode } }\n\nexport function AdminNotFound({ data }: NotFoundRouteProps) {\n // TanStack exposes not-found data as unknown; this route only receives the shape thrown below.\n const { routeKey, rscPayload } = (data ?? {}) as AdminNotFoundData\n if (!rscPayload) {\n return <NotFoundClient />\n }\n return <Fragment key={routeKey}>{rscPayload.page}</Fragment>\n}\n"],"names":["NotFoundClient","useRouteTransition","useLoaderData","Fragment","useDeferredValue","useEffect","AdminPage","data","strict","rscPayload","holdRouteTransition","isRscPayloadDeferred","releaseRouteTransition","page","AdminNotFound","routeKey"],"mappings":"AAAA;;AAIA,SAASA,cAAc,EAAEC,kBAAkB,QAAQ,iBAAgB;AACnE,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,QAAQ,EAAEC,gBAAgB,EAAEC,SAAS,QAAQ,QAAO;AAE7D,OAAO,SAASC;IACd,+HAA+H;IAC/H,2HAA2H;IAC3H,MAAMC,OAAOL,cAAc;QAAEM,QAAQ;IAAM;IAE3C,+EAA+E;IAC/E,yEAAyE;IACzE,qEAAqE;IACrE,MAAMC,aAAaL,iBAAiBG,MAAME;IAC1C,MAAM,EAAEC,mBAAmB,EAAE,GAAGT;IAChC,MAAMU,uBAAuBF,eAAeF,MAAME;IAElDJ,UAAU;QACR,IAAI,CAACM,sBAAsB;YACzB;QACF;QAEA,MAAMC,yBAAyBF;QAE/B,OAAO,IAAME;IACf,GAAG;QAACF;QAAqBC;KAAqB;IAE9C,qBAAO,KAACR;kBAAUM,YAAYI;;AAChC;AAIA,OAAO,SAASC,cAAc,EAAEP,IAAI,EAAsB;IACxD,+FAA+F;IAC/F,MAAM,EAAEQ,QAAQ,EAAEN,UAAU,EAAE,GAAIF,QAAQ,CAAC;IAC3C,IAAI,CAACE,YAAY;QACf,qBAAO,KAACT;IACV;IACA,qBAAO,KAACG;kBAAyBM,WAAWI,IAAI;OAA1BE;AACxB"}
@@ -1,4 +1,4 @@
1
- import type { RenderableServerComponent } from '@tanstack/react-start/rsc';
1
+ import type { RenderableServerComponentBuilder } from '@tanstack/react-start/rsc';
2
2
  import type { ImportMap, SanitizedConfig } from 'payload';
3
3
  import type { AdminPageMetadata } from '../metadata.js';
4
4
  export type LoadAdminPageArgs = {
@@ -7,7 +7,10 @@ export type LoadAdminPageArgs = {
7
7
  search?: Record<string, string | string[]>;
8
8
  splat?: string;
9
9
  };
10
- type RSCPayload = RenderableServerComponent<React.ReactElement>;
10
+ type RSCPayload = RenderableServerComponentBuilder<{
11
+ page: React.ReactElement;
12
+ routeKey: string;
13
+ }>;
11
14
  export type LoadAdminPageResult = {
12
15
  _notFound: true;
13
16
  routeKey?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/adapters/views/server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAKzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAOvD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,eAAe,CAAA;IACvB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,KAAK,UAAU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