vueform / multiselect

Vue 3 multiselect component with single select, multiselect and tagging options (+Tailwind CSS support).
https://vueform.com
MIT License
807 stars 150 forks source link

setting v-model to an undefined object property then setting the property at runtime doesnt work #328

Closed XiDanko closed 1 year ago

XiDanko commented 1 year ago

Version

Description

when setting multiselect v-model to an empty object property (that will be provided at run time) multiselect wont select the option even after providing the property with valid value at run time ps: it was working on version 2.4.2 and below ps: this behavior also exists in toggle package it was working on version 2.0.2 and below

Demo

https://jsfiddle.net/vg6xs29m/1/

walnut-co commented 1 year ago

one up for the issue ? any suggestions / solutions ?

yogesh-gohil commented 1 year ago

can you check this ? and let me know if any confusion.

https://jsfiddle.net/ubLo1pvj/

XiDanko commented 1 year ago

@yogesh-gohil there is not confusion i dont want to bind to an object i want to bind to an object property https://jsfiddle.net/6xcbg2de/1/ note setting the target property in post object resolves the issue but this behavior is not very welcoming though it was working fine on versions below 2.4.2

klausbetz commented 1 year ago

@XiDanko Lately, I ran in the described issue using 2.5.6. Unfortunately, updating to 2.6.2 didn't improve the behavior.

When the passed-in v-model is undefined at first, it won't be reconsidered when updating it later on asynchronously.

This PR should fix this issue by keeping the reference to the original v-model alive using an internal computed property.

XiDanko commented 1 year ago

@klausbetz thank you for sharing your fix i hope they merge it in the next release i found the same problem with their toggle library as well