Skip to content

Commit

Permalink
fix(slider): incorrect onValueCommitted calls (#1218)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikededo authored Jun 26, 2024
1 parent 65b6ea2 commit f924049
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-suits-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 1,5 @@
---
'@melt-ui/svelte': patch
---

fix(slider): `onValueCommitted` called if the slider had an active state
6 changes: 3 additions & 3 deletions src/lib/builders/slider/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 521,11 @@ export const createSlider = (props?: CreateSliderProps) => {
};

const pointerUp = () => {
isActive.set(false);

if (withDefaults?.onValueCommitted) {
if (withDefaults?.onValueCommitted && isActive.get()) {
withDefaults.onValueCommitted(value.get());
}

isActive.set(false);
};

const unsub = executeCallbacks(
Expand Down

0 comments on commit f924049

Please sign in to comment.