NightCatSama/vue-slider-component

Equal min, value, max causes an error when trying to move the slider

joonaspaakko opened this issue · 4 comments

Equal min, value, max causes an error when trying to move the slider. Doesn't seem like a huge issue since the error doesn't break anything and the slider continues to function normally after the values change.

Example settings that would cause this issue:

Plus a codesandbox link.

{
  min: 0,
  value: [0, 0],
  max: 0,
}

Additional info

  • Doesn't seem to matter if the value is a single number or an array with multiple numbers
  • Disabling the slider when this happens silences the error
  • The number can be anything, as long as min, value, max are all the same.
  • #584 seems related and on that note, I should say I had the issue in 3.2.13 originally and I tried to resolve it by updating to the latest version (3.2.15) but that didn't help.

Code snippet where the error TypeError: Cannot read properties of undefined (reading 'disabled') happens:

carbon

Versions I tested this issue with

  • vue version: 2.6.11 and 2.6.14
  • vue-slider-component: 3.2.13 and 3.2.15

The component does not take this situation into account; for a slider component, the starting point and the ending point should not be the same.

True, it's not much of an issue and more of an unnecessary error. I do generally agree that it kinda defeats the purpose of a slider when all the values match, but when the slider values are dictated by data sets with varying amounts of data, there are bound to be situations where all the values are the same in which case the errors can be a little annoying.

In my original post I said I was seeing the error with the slider disabled, but it seems like I was wrong about that.

In my personal project I'm using the sliders in filters (1 per filter) and basically every time you do a search the data set changes. For example: sometimes the search might give you a few books with no ratings and sometimes all books can have the same exact rating. In my specific case hiding the slider didn't seem like a good solution, because it was better for users to see that the filter exists, even it can't be adjusted at that exact moment.


As I was double checking my claims in the original post, I noticed another weird error and I'm wondering if this is an actual issue of perhaps I'm doing something wrong. The original post like I said is a kind of a non-issue, but assuming I'm not just doing something wrong, there appears to be a worse error message in a similar scenario.

Changing the values seems to throw this error The "value" must be less than or equal to the "max". but only when the starting value (array or not doesn't matter) matches min or max or both of them. Even when the new value is clearly within min and max. In this codesandbox I'm changing the value with a 3 second delay in created() and that's when you see the error.

It's difficult to debug the sliders if valid values cause errors. Perhaps I should post a new issue?

This is a known issue and there is not a good way to handle this simultaneous assignment #343

can set silent: true to hide the error.

Well that's unfortunate. Silencing all errors kinda defeats the purpose, since the issue I have with those errors is that they make it difficult to distinguish real errors.

I guess I can let go of both of these.