vue-simple-suggest icon indicating copy to clipboard operation
vue-simple-suggest copied to clipboard

vue-simple-suggest should not mutate the array provided to the "list" property

Open tbl0605 opened this issue 2 years ago • 0 comments

Hi, currently vue-simple-suggest mutates any array supplied to the "list" property when the "max-suggestions" property is used.

<vue-simple-suggest
    :list="listOfSuggestions"
    :max-suggestions="99"
    ...
/>

This breaks the One-Way Data Flow recommended by Vue and affects parent state by triggering any watcher on the listOfSuggestions list, etc...

The reason for this property mutation is that the library internally uses the splice() function on the provided list, instead of using the slice() function which returns an array copy.

Thierry.

tbl0605 avatar Sep 15 '23 13:09 tbl0605