diff --git a/src/lib/components/ui/segmented-control/SegmentedControl.svelte b/src/lib/components/ui/segmented-control/SegmentedControl.svelte index 7cf865ea..92962c93 100644 --- a/src/lib/components/ui/segmented-control/SegmentedControl.svelte +++ b/src/lib/components/ui/segmented-control/SegmentedControl.svelte @@ -37,9 +37,16 @@ // Provide variant to child segments via context setContext('segmented-control-variant', variant) + // Track previous value to only fire callback on actual changes (not initialization) + let previousValue = $state(undefined) + $effect(() => { if (onValueChange && value !== undefined) { - onValueChange(value) + // Only call onValueChange if value actually changed (not on initialization) + if (previousValue !== undefined && value !== previousValue) { + onValueChange(value) + } + previousValue = value } })