fix: error on duplicate partial name (#1958)
This commit is contained in:
@@ -367,6 +367,13 @@ options.__b = (vnode: VNode<Record<string, unknown>>) => {
|
||||
`<Partial> components cannot be used inside islands.`,
|
||||
);
|
||||
}
|
||||
const name = vnode.props.name as string;
|
||||
if (current.encounteredPartials.has(name)) {
|
||||
current.error = new Error(
|
||||
`Duplicate partial name "${name}" found. The partial name prop is expected to be unique among partial components.`,
|
||||
);
|
||||
}
|
||||
current.encounteredPartials.add(name);
|
||||
|
||||
const mode = encodePartialMode(
|
||||
// deno-lint-ignore no-explicit-any
|
||||
@@ -374,7 +381,7 @@ options.__b = (vnode: VNode<Record<string, unknown>>) => {
|
||||
);
|
||||
vnode.props.children = wrapWithMarker(
|
||||
vnode.props.children,
|
||||
`frsh-partial:${vnode.props.name}:${mode}:${vnode.key ?? ""}`,
|
||||
`frsh-partial:${name}:${mode}:${vnode.key ?? ""}`,
|
||||
);
|
||||
} else if (
|
||||
vnode.key && (current.islandDepth > 0 || current.partialDepth > 0)
|
||||
|
||||
Reference in New Issue
Block a user