vue-multiselect icon indicating copy to clipboard operation
vue-multiselect copied to clipboard

Internal search fails on null value

Open Maze-fr opened this issue 5 years ago • 4 comments

Hello,

I recently found this lib, and it's really great. However, I found a little bug, which is just a missing fail-safe.

I use object options, and one of my options is { code: null, label: null }. When I typed a letter for the search filter, I had a big fail in the console saying that the label is null (which is true...). I think it could be nice to have a test to ignore null values when filtering.

Since then, I cleaned my list of options... but I spent a long moment to find out what was wrong.

Thanks

Maze-fr avatar May 20 '20 17:05 Maze-fr

Hi! I am not the maintainer of this component, but it seems that having an error for non-existent labels is actually the way to go. You should never have null as some value, that is supposed to be unique. For that matter, you shouldn't use booleans for such things either... So, probably changing this to a warning or removing whatsoever is not the way to go, if you want to have clean code on the user side :)

Zyberg avatar May 23 '20 08:05 Zyberg

Actually, the null option doesn't appear visually into the list. Or maybe, as there is no value to display, it is there but we can't see it. Since I removed the null value from my request, I don't really want to go back on my previous code, so I can't check.

I agree that we should never have null values. However, I think the search functionality is a side feature of the select and shouldn't block.

Maze-fr avatar May 23 '20 11:05 Maze-fr

@Maze-fr I'm having trouble replicating this - can you build a simple example in a repo or a code platform like https://jsfiddle.net/mattelen/8cyt3hrn/4/. Thanks

mattelen avatar Nov 25 '22 17:11 mattelen

It was 2 years and a half ago... Since then, I went on many other projects, changed company, etc. I don't even remember the context... Sorry.

Maze-fr avatar Nov 26 '22 13:11 Maze-fr