Duplicates
Latest version
Current behavior 😯
I have a [slug.tsx]. meta title and description render "undefined" when load page directly, but render title correctly when navigate from "list" page to "[slug.tsx]" page with an anchor.
// [slug.tsx]
const getPillQuery = query(async (slug: string) => {
"use server";
return getPillBySlug(slug);
}, "pill");
export const route = {
load: ({ params }) => {
void getPillBySlug(params.slug);
},
} satisfies RouteDefinition;
export default function PillPage(props: RouteSectionProps) {
const pill = createAsync(() => getPillQuery(props.params.slug))
return (
<main>
<Title>{pill()?.title}</Title>
todo
</main>
);
}
and app.config.ts
export default defineConfig({
server: {
prerender: {
routes: ["/", "/pills"],
},
hooks: {
async "prerender:routes"(routes) {
const pills = await getPills();
pills.forEach(({ id, slug }) => routes.add(`/pills/${slug}`));
},
},
},
});
Expected behavior 🤔
I have a list of "pills" and want to generate a build time N pages. Each page should have right info.
Maybe I do in a wrong way
Context 🔦
No response
Your environment 🌎
Duplicates
Latest version
Current behavior 😯
I have a
[slug.tsx]. meta title and description render "undefined" when load page directly, but render title correctly when navigate from "list" page to "[slug.tsx]" page with an anchor.and
app.config.tsExpected behavior 🤔
I have a list of "pills" and want to generate a build time N pages. Each page should have right info.
Maybe I do in a wrong way
Context 🔦
No response
Your environment 🌎