Reduce update frequency for volume

This commit is contained in:
Half-Shot
2024-12-03 13:16:43 +00:00
parent c3cf755fc4
commit 3d89b1033d
3 changed files with 52 additions and 35 deletions

View File

@@ -16,6 +16,9 @@ interface Props {
className?: string;
label: string;
value: number;
/**
* Event handler called when the value changes during an interaction.
*/
onValueChange: (value: number) => void;
/**
* Event handler called when the value changes at the end of an interaction.
@@ -45,7 +48,7 @@ export const Slider: FC<Props> = ({
disabled,
}) => {
const onValueChange = useCallback(
([v]: number[]) => onValueChangeProp(v),
([v]: number[]) => onValueChangeProp?.(v),
[onValueChangeProp],
);
const onValueCommit = useCallback(