-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Bug report
I am using shadcn component Button which looks like this:
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
);
}
);
Button.displayName = "Button";
And use it in my code ( in my server component react page ) like this:
<Button variant="outline" size="sm" asChild>
<Link
href={`somePath`}
>
{t("common.view")}
</Link>
</Button>
From version 1.2.2 of "@radix-ui/react-slot"
Server Page generate nothing no html element (lack of link element)
The slot made it to be disappeared
Back to 1.2.0 solve the issue
Workaround
I just made the Button the child of the Link and it works and is okey to avoid using slot.
I will stay with that. I just have wanted to mention it to help maintain the package :)
Your environment
packages:
"@radix-ui/react-slot": "1.2.2",
"react": "^19.0.0",
"next": "^15.2.5",
Important info
I see that this issue doesn't appear in client component ("use client")
varmil, avihu-pattern, CarlosDeucherMoretoCont, VojtechVidra, itzaks and 11 more
Metadata
Metadata
Assignees
Labels
No labels