Skip to content

Commit

Permalink
fix: slider not normalizing value to array if multiple thumbs exist
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Aug 17, 2024
1 parent 30aa9f1 commit e26e5e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/useSlider/slider.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { InjectionKey, computed, onBeforeUnmount, provide, ref, toValue } from 'vue';
import { useLabel } from '../a11y/useLabel';
import { AriaLabelableProps, Arrayable, Direction, Orientation, Reactivify, TypedSchema } from '../types';
import { isNullOrUndefined, normalizeProps, useUniqId, withRefCapture } from '../utils/common';
import { isNullOrUndefined, normalizeArrayable, normalizeProps, useUniqId, withRefCapture } from '../utils/common';
import { toNearestMultipleOf } from '../utils/math';
import { useLocale } from '../i18n/useLocale';
import { useFormField } from '../useFormField';
Expand Down Expand Up @@ -142,12 +142,12 @@ export function useSlider(_props: Reactivify<SliderProps, 'schema'>) {
return;
}

if (!Array.isArray(fieldValue.value)) {
if (thumbs.value.length <= 1) {
setValue(value);
return;
}

const nextValue = [...fieldValue.value];
const nextValue = normalizeArrayable(fieldValue.value).filter(v => !isNullOrUndefined(v));
nextValue[idx] = value;
setValue(nextValue);
}
Expand Down

0 comments on commit e26e5e2

Please sign in to comment.