fix(frontend): resolve button hydration mismatch with undefined variant/size (#1506)

Server-rendered data-variant={undefined} didn't match client hydration.
Now only render data-variant and data-size when explicitly set.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: JeffJiang <for-eleven@hotmail.com>
This commit is contained in:
Albert Zheng 2026-04-04 11:21:04 +08:00 committed by GitHub
parent 4ceb18c6e4
commit 6473d38917
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,8 +52,8 @@ function Button({
return (
<Comp
data-slot="button"
data-variant={variant}
data-size={size}
{...(variant !== undefined && { "data-variant": variant })}
{...(size !== undefined && { "data-size": size })}
className={cn(buttonVariants({ variant, size, className }))}
{...props}
/>