@payloadcms/tanstack-start 4.0.0-internal.164164a → 4.0.0-internal.167c7cd
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.
|
@@ -49,6 +49,7 @@ export declare function payloadAdminSplatRoute({ load }: {
|
|
|
49
49
|
title: string;
|
|
50
50
|
})[];
|
|
51
51
|
};
|
|
52
|
+
notFoundComponent: typeof AdminNotFound;
|
|
52
53
|
loader: {
|
|
53
54
|
handler: ({ location, params }: {
|
|
54
55
|
location: any;
|
|
@@ -62,19 +63,10 @@ export declare function payloadAdminSplatRoute({ load }: {
|
|
|
62
63
|
searchKey: string;
|
|
63
64
|
};
|
|
64
65
|
validateSearch: (search: Record<string, unknown>) => Record<string, unknown>;
|
|
65
|
-
notFoundComponent: typeof AdminNotFound;
|
|
66
66
|
};
|
|
67
67
|
/**
|
|
68
|
-
* Route options for the admin index route (`/_payload/admin/`).
|
|
69
|
-
*
|
|
70
|
-
* `AdminNotFound` falls through to the bare client view.
|
|
71
|
-
*
|
|
72
|
-
* `notFoundComponent` must be set here even though the payload is never forwarded:
|
|
73
|
-
* TanStack picks the boundary component from its presence (`routeNotFoundComponent ?
|
|
74
|
-
* CatchNotFound : SafeFragment`), so leaving it off gives this route a different
|
|
75
|
-
* component type than the splat route at the same position in the tree. Navigating
|
|
76
|
-
* between the two would then unmount the whole admin subtree and remount it —
|
|
77
|
-
* blanking the page for as long as the new view takes to render.
|
|
68
|
+
* Route options for the admin index route (`/_payload/admin/`). Not-found
|
|
69
|
+
* results omit the RSC payload and fall back to `NotFoundClient`.
|
|
78
70
|
*/
|
|
79
71
|
export declare function payloadAdminIndexRoute({ load }: {
|
|
80
72
|
load: AdminLoad;
|
|
@@ -102,6 +94,7 @@ export declare function payloadAdminIndexRoute({ load }: {
|
|
|
102
94
|
title: string;
|
|
103
95
|
})[];
|
|
104
96
|
};
|
|
97
|
+
notFoundComponent: typeof AdminNotFound;
|
|
105
98
|
loader: {
|
|
106
99
|
handler: ({ location, params }: {
|
|
107
100
|
location: any;
|
|
@@ -115,7 +108,6 @@ export declare function payloadAdminIndexRoute({ load }: {
|
|
|
115
108
|
searchKey: string;
|
|
116
109
|
};
|
|
117
110
|
validateSearch: (search: Record<string, unknown>) => Record<string, unknown>;
|
|
118
|
-
notFoundComponent: typeof AdminNotFound;
|
|
119
111
|
};
|
|
120
112
|
export {};
|
|
121
113
|
//# sourceMappingURL=adminRoutes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adminRoutes.d.ts","sourceRoot":"","sources":["../../src/routes/adminRoutes.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAY,KAAK,SAAS,EAAoB,MAAM,OAAO,CAAA;AAIlE;;;;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;AAclB,iBAAS,SAAS,
|
|
1
|
+
{"version":3,"file":"adminRoutes.d.ts","sourceRoot":"","sources":["../../src/routes/adminRoutes.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAY,KAAK,SAAS,EAAoB,MAAM,OAAO,CAAA;AAIlE;;;;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;AAclB,iBAAS,SAAS,gCAWjB;AAED,iBAAS,aAAa,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,SAAS,CAAA;KAAE,CAAA;CAAE,+BAMrF;AAiDD;;;;;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;;6BAGQ;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,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE;;2BAjD3C;QAAE,UAAU,CAAC,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;QAUzC,OAAO,yBAA+B;YAAE,QAAQ,EAAE,GAAG,CAAC;YAAC,MAAM,EAAE,GAAG,CAAA;SAAE;QAYpE,eAAe;;6BAGQ;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;QAC1D,SAAS;;6BAEc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EA2BjD"}
|
|
@@ -26,12 +26,9 @@ function AdminPage() {
|
|
|
26
26
|
const data = useLoaderData({
|
|
27
27
|
strict: false
|
|
28
28
|
});
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
// de-opts to a synchronous render and that suspension hits the nearest fallback, which is
|
|
33
|
-
// `null` unless a `pendingComponent` is configured — blanking the page. Deferring the payload
|
|
34
|
-
// keeps the previous view painted until the new one is renderable, then swaps.
|
|
29
|
+
// Route state comes from an external store, so a new RSC payload that suspends
|
|
30
|
+
// on code-split client references can reveal the router's null fallback.
|
|
31
|
+
// Keep the current payload painted until the next one is renderable.
|
|
35
32
|
const rscPayload = useDeferredValue(data?.rscPayload);
|
|
36
33
|
return /*#__PURE__*/ _jsx(Fragment, {
|
|
37
34
|
children: rscPayload
|
|
@@ -49,6 +46,9 @@ function AdminNotFound(props) {
|
|
|
49
46
|
const adminRouteOptions = ({ forwardNotFoundPayload, load, resolveSplat })=>({
|
|
50
47
|
component: AdminPage,
|
|
51
48
|
head: ({ loaderData })=>getAdminMeta(loaderData?.metadata),
|
|
49
|
+
// Both admin routes must use the same boundary type so index ↔ splat
|
|
50
|
+
// navigation preserves the existing admin subtree.
|
|
51
|
+
notFoundComponent: AdminNotFound,
|
|
52
52
|
// `staleReloadMode: 'blocking'` (a property of the loader *object*, not a
|
|
53
53
|
// sibling route option — router-core only reads it off a non-function loader)
|
|
54
54
|
// makes stale-match revalidation await the fresh loader before committing,
|
|
@@ -82,35 +82,21 @@ const adminRouteOptions = ({ forwardNotFoundPayload, load, resolveSplat })=>({
|
|
|
82
82
|
* `data.rscPayload`) for unknown/access-denied routes, falling back to the bare
|
|
83
83
|
* client view.
|
|
84
84
|
*/ export function payloadAdminSplatRoute({ load }) {
|
|
85
|
-
return {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}),
|
|
91
|
-
notFoundComponent: AdminNotFound
|
|
92
|
-
};
|
|
85
|
+
return adminRouteOptions({
|
|
86
|
+
forwardNotFoundPayload: true,
|
|
87
|
+
load,
|
|
88
|
+
resolveSplat: (params)=>params._splat ?? ''
|
|
89
|
+
});
|
|
93
90
|
}
|
|
94
91
|
/**
|
|
95
|
-
* Route options for the admin index route (`/_payload/admin/`).
|
|
96
|
-
*
|
|
97
|
-
* `AdminNotFound` falls through to the bare client view.
|
|
98
|
-
*
|
|
99
|
-
* `notFoundComponent` must be set here even though the payload is never forwarded:
|
|
100
|
-
* TanStack picks the boundary component from its presence (`routeNotFoundComponent ?
|
|
101
|
-
* CatchNotFound : SafeFragment`), so leaving it off gives this route a different
|
|
102
|
-
* component type than the splat route at the same position in the tree. Navigating
|
|
103
|
-
* between the two would then unmount the whole admin subtree and remount it —
|
|
104
|
-
* blanking the page for as long as the new view takes to render.
|
|
92
|
+
* Route options for the admin index route (`/_payload/admin/`). Not-found
|
|
93
|
+
* results omit the RSC payload and fall back to `NotFoundClient`.
|
|
105
94
|
*/ export function payloadAdminIndexRoute({ load }) {
|
|
106
|
-
return {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}),
|
|
112
|
-
notFoundComponent: AdminNotFound
|
|
113
|
-
};
|
|
95
|
+
return adminRouteOptions({
|
|
96
|
+
forwardNotFoundPayload: false,
|
|
97
|
+
load,
|
|
98
|
+
resolveSplat: ()=>''
|
|
99
|
+
});
|
|
114
100
|
}
|
|
115
101
|
|
|
116
102
|
//# sourceMappingURL=adminRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/routes/adminRoutes.tsx"],"sourcesContent":["'use client'\n\nimport { NotFoundClient } from '@payloadcms/ui'\nimport { notFound, redirect, useLoaderData } from '@tanstack/react-router'\nimport { Fragment, type ReactNode, useDeferredValue } from 'react'\n\nimport { getAdminMeta } from '../utilities/meta.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\nfunction 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 //
|
|
1
|
+
{"version":3,"sources":["../../src/routes/adminRoutes.tsx"],"sourcesContent":["'use client'\n\nimport { NotFoundClient } from '@payloadcms/ui'\nimport { notFound, redirect, useLoaderData } from '@tanstack/react-router'\nimport { Fragment, type ReactNode, useDeferredValue } from 'react'\n\nimport { getAdminMeta } from '../utilities/meta.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\nfunction 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\n return <Fragment>{rscPayload}</Fragment>\n}\n\nfunction AdminNotFound(props: { data?: { routeKey?: string; rscPayload?: ReactNode } }) {\n const rscPayload = props?.data?.rscPayload\n if (!rscPayload) {\n return <NotFoundClient />\n }\n return <Fragment key={props?.data?.routeKey}>{rscPayload}</Fragment>\n}\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',\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":["NotFoundClient","notFound","redirect","useLoaderData","Fragment","useDeferredValue","getAdminMeta","searchToRecord","searchStr","Object","fromEntries","URLSearchParams","runLoader","load","splat","data","_splat","search","_redirect","to","AdminPage","strict","rscPayload","AdminNotFound","props","routeKey","adminRouteOptions","forwardNotFoundPayload","resolveSplat","component","head","loaderData","metadata","notFoundComponent","loader","handler","location","params","_notFound","undefined","staleReloadMode","loaderDeps","searchKey","JSON","stringify","validateSearch","payloadAdminSplatRoute","payloadAdminIndexRoute"],"mappings":"AAAA;;AAEA,SAASA,cAAc,QAAQ,iBAAgB;AAC/C,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,yBAAwB;AAC1E,SAASC,QAAQ,EAAkBC,gBAAgB,QAAQ,QAAO;AAElE,SAASC,YAAY,QAAQ,uBAAsB;AAWnD,MAAMC,iBAAiB,CAACC,YACtBC,OAAOC,WAAW,CAAC,IAAIC,gBAAgBH;AAEzC,MAAMI,YAAY,OAAOC,MAAiBC,OAAeN;IACvD,MAAMO,OAAO,MAAMF,KAAK;QAAEE,MAAM;YAAEC,QAAQF;YAAOG,QAAQV,eAAeC;QAAW;IAAE;IACrF,IAAIO,MAAMG,WAAW;QACnB,qHAAqH;QACrH,MAAMhB,SAAS;YAAEiB,IAAIJ,KAAKG,SAAS;QAAC;IACtC;IACA,OAAOH;AACT;AAEA,SAASK;IACP,+HAA+H;IAC/H,2HAA2H;IAC3H,MAAML,OAAOZ,cAAc;QAAEkB,QAAQ;IAAM;IAE3C,+EAA+E;IAC/E,yEAAyE;IACzE,qEAAqE;IACrE,MAAMC,aAAajB,iBAAiBU,MAAMO;IAE1C,qBAAO,KAAClB;kBAAUkB;;AACpB;AAE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AAwB;QACxBd;QACAe,cAAc,IAAM;IACtB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/tanstack-start",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.167c7cd",
|
|
4
4
|
"description": "TanStack Start framework adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"qs-esm": "^7.0.2",
|
|
61
|
-
"@payloadcms/translations": "4.0.0-internal.
|
|
62
|
-
"@payloadcms/ui": "4.0.0-internal.
|
|
61
|
+
"@payloadcms/translations": "4.0.0-internal.167c7cd",
|
|
62
|
+
"@payloadcms/ui": "4.0.0-internal.167c7cd"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@tanstack/react-router": "^1.120.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"react": "^19.0.0",
|
|
72
72
|
"react-dom": "^19.0.0",
|
|
73
73
|
"vite": ">=8.0.0",
|
|
74
|
-
"payload": "4.0.0-internal.
|
|
74
|
+
"payload": "4.0.0-internal.167c7cd"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"@tanstack/react-router": "^1.120.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"react": "^19.0.0",
|
|
82
82
|
"react-dom": "^19.0.0",
|
|
83
83
|
"vite": ">=8.0.0",
|
|
84
|
-
"payload": "4.0.0-internal.
|
|
84
|
+
"payload": "4.0.0-internal.167c7cd"
|
|
85
85
|
},
|
|
86
86
|
"peerDependenciesMeta": {
|
|
87
87
|
"@vitejs/plugin-react": {
|