Skip to content

Commit 87e1e76

Browse files
Update ui/slider.tsx
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 0fe6d9f commit 87e1e76

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

ui/slider.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ function Slider({
1111
max = 100,
1212
...props
1313
}: React.ComponentProps<typeof SliderPrimitive.Root>) {
14+
const finalValue = value ?? defaultValue
1415
const _values = React.useMemo(
1516
() =>
16-
Array.isArray(value)
17-
? value
18-
: Array.isArray(defaultValue)
19-
? defaultValue
20-
: [min, max],
21-
[value, defaultValue, min, max]
17+
Array.isArray(finalValue)
18+
? finalValue
19+
: typeof finalValue === "number"
20+
? [finalValue]
21+
: [50], // Default to a single thumb
22+
[finalValue]
2223
)
2324

2425
return (

0 commit comments

Comments
 (0)