Skip to content
New issue

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

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

Already on GitHub? # to your account

MultiSelect should not directly update the "value" prop #283

Closed
nsorin opened this issue May 21, 2019 · 1 comment
Closed

MultiSelect should not directly update the "value" prop #283

nsorin opened this issue May 21, 2019 · 1 comment
Assignees

Comments

@nsorin
Copy link

nsorin commented May 21, 2019

Version & browser

Version 0.31.5, all browsers

Which component

MultiSelect

Expected behavior

The props should not be modified by the component and should only be used as they are provided by the parent. Updates should only come from events, which are then handled by the parent. In the case of value, the proper way to update it would be to make a copy, update the copy and send it back to the parent via the input event.

Actual behavior

When an option is selected, this.value is updated. This interferes with parent logic by updating one of its variables. From the source code:

          if (index >= 0) {
            this.value.splice(index, 1)
            this.$emit('change', this.value)
          } else if (this.limit === 0 || this.value.length < this.limit) {
            this.value.push(value)
            this.$emit('change', this.value)
          }
@wxsms wxsms self-assigned this May 22, 2019
@wxsms
Copy link
Member

wxsms commented May 22, 2019

thanks for the feedback.

@wxsms wxsms closed this as completed in 9132ed1 May 22, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants