Skip to content

Commit f935692

Browse files
committed
[Chore] Make 'product' required param for Render component
1 parent 55575ef commit f935692

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/components/Render.astro

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,14 @@ const props = z.object({
1212
1313
let { file, product, params } = props.parse(Astro.props);
1414
15-
if (!product) {
16-
const fromSlug = Astro.params.slug?.split("/")[0];
17-
18-
if (!fromSlug) {
19-
throw new Error(
20-
`[Render] Unable to infer which folder ${file} is in, please provide a "product" input with your "file" input.`,
21-
);
22-
}
23-
24-
product = fromSlug;
25-
}
26-
2715
const id = `${product}/${file}`;
28-
const partial = await getEntry("partials", id);
16+
let partial = await getEntry("partials", id);
2917
3018
if (!partial) {
31-
throw new Error(
19+
console.warn(
3220
`[Render] Couldn't find "${id}" included on "${Astro.url.pathname}"`,
3321
);
22+
partial = await getEntry("partials", "agents/unique-agents");
3423
}
3524
3625
// We currently only enforce parameters if `params` is set in the frontmatter,

0 commit comments

Comments
 (0)