Skip to content

Commit 48243a4

Browse files
committed
fix(slider): ensure value change end is called
1 parent bcfe50c commit 48243a4

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

.changeset/silent-melons-doubt.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@zag-js/slider": patch
3+
---
4+
5+
Fix issue where programmatic value changes do not trigger the `onValueChangeEnd` callback. This affects the following
6+
API methods:
7+
8+
- `slider.setThumbValue(index, value)`
9+
- `slider.setValue(value)`
10+
- `slider.increment(index)`
11+
- `slider.decrement(index)`

packages/machines/slider/src/slider.machine.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,17 @@ export const machine = createMachine<SliderSchema>({
133133
SET_VALUE: [
134134
{
135135
guard: "hasIndex",
136-
actions: ["setValueAtIndex"],
136+
actions: ["setValueAtIndex", "invokeOnChangeEnd"],
137137
},
138138
{
139-
actions: ["setValue"],
139+
actions: ["setValue", "invokeOnChangeEnd"],
140140
},
141141
],
142142
INCREMENT: {
143-
actions: ["incrementThumbAtIndex"],
143+
actions: ["incrementThumbAtIndex", "invokeOnChangeEnd"],
144144
},
145145
DECREMENT: {
146-
actions: ["decrementThumbAtIndex"],
146+
actions: ["decrementThumbAtIndex", "invokeOnChangeEnd"],
147147
},
148148
},
149149

0 commit comments

Comments
 (0)