Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tbl0605
Copy link
Contributor

@tbl0605 tbl0605 commented Sep 15, 2023

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 added a commit to tbl0605/vue-simple-suggest that referenced this pull request Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant