Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lib): wrong thumbs of range Slider
- The bug that `Slider` showed thumbs at wrong positions when a range slider was used. This bug was caused by circular update among the following methods and data, - modelValue - setValues - value1 - value2 - onInternalValueUpdate - emitValue('update:modelValue') The problem was in the `setValues` method. Its intention is to update `value1` and `value2`, and then do `onInternalValueUpdate`. But because it updated `value1` and `value2` one by one, `onInternalValueUpdate` was prematurely called after only `value1` was updated. The premature `onInternalVaueUpdate` ended up with premature emit of `update:modelValue` event, and the thumb positions of slider were messed up. This also caused a "maximum recusion exceeded" error when `Slider` component was updated but I have not confirmed this happens in a production environment. The bug is fixed by introducing a `internal` data that works as a buffer to update `value1` and `value2` with a single shot. It is also used to stop unnecessary propagation of `value1` and `value2` update. I think that this did not happen on Vue 2 because watch methods are called in another event loop iteration. - Minor changes, - Events to be emitted by `Slider` and `SliderThumb` are listed in `emits`. - `$destroy` call in `SliderTick` is removed because it is obsolted on Vue 3. - Automatic ESLint fix is applied to `SliderTick`.
- Loading branch information