From 8effac014141969388e931b9a78d1e45976845c1 Mon Sep 17 00:00:00 2001 From: Hunter Johnston <64506580+huntabyte@users.noreply.github.com> Date: Sun, 17 Nov 2024 12:26:27 -0500 Subject: [PATCH] next: fix radio group `onValueChange` loop (#939) --- .changeset/wise-apples-eat.md | 5 +++++ .../src/lib/bits/radio-group/components/radio-group.svelte | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/wise-apples-eat.md diff --git a/.changeset/wise-apples-eat.md b/.changeset/wise-apples-eat.md new file mode 100644 index 000000000..5959f2aa9 --- /dev/null +++ b/.changeset/wise-apples-eat.md @@ -0,0 +1,5 @@ +--- +"bits-ui": patch +--- + +fix: radio group onValueChange loop diff --git a/packages/bits-ui/src/lib/bits/radio-group/components/radio-group.svelte b/packages/bits-ui/src/lib/bits/radio-group/components/radio-group.svelte index 4de61fc11..7365b2c58 100644 --- a/packages/bits-ui/src/lib/bits/radio-group/components/radio-group.svelte +++ b/packages/bits-ui/src/lib/bits/radio-group/components/radio-group.svelte @@ -32,6 +32,7 @@ value: box.with( () => value, (v) => { + if (v === value) return; if (controlledValue) { onValueChange(v); } else {