fix(web): avoid prehydration script in slider (#34676)

This commit is contained in:
yyh
2026-04-08 12:03:19 +08:00
committed by GitHub
parent f5322e45fc
commit 909c062ee1
2 changed files with 7 additions and 1 deletions

View File

@@ -70,4 +70,10 @@ describe('Slider', () => {
const sliderWrapper = container.querySelector('.outer-test')
expect(sliderWrapper).toBeInTheDocument()
})
it('should not render prehydration script tags', () => {
const { container } = render(<Slider value={10} onValueChange={vi.fn()} aria-label="Value" />)
expect(container.querySelector('script')).not.toBeInTheDocument()
})
})

View File

@@ -82,7 +82,7 @@ export function Slider({
step={step}
disabled={disabled}
name={name}
thumbAlignment="edge"
thumbAlignment="edge-client-only"
className={cn(sliderRootClassName, className)}
>
<BaseSlider.Control className={sliderControlClassName}>