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

SelectMenu ignoring initial object values #2086

Open
ThePlay3r opened this issue Aug 28, 2024 · 2 comments · May be fixed by #2566
Open

SelectMenu ignoring initial object values #2086

ThePlay3r opened this issue Aug 28, 2024 · 2 comments · May be fixed by #2566
Labels
bug Something isn't working triage

Comments

@ThePlay3r
Copy link

ThePlay3r commented Aug 28, 2024

Environment



Version

Pro 1.4.1

Reproduction

https://stackblitz.com/edit/nuxt-ui-u6tm1b?file=app.vue

Description

When using a v-model prop with some initial object values (such as fetched already selected data from backend), the <USelectMenu> component doesn't show these as selected and seems to ignore them completely.

Even when selecting the same objects again, it just seems to add them to the array and disregard anything, that was there previously.

Additional context

The behaviour changes when setting the by prop. In my case, I set it to id, after which I can see the object as selected, but only in the dropdown.
This also allows me to edit the data as normal. (Select/Deselect)
However the button itself still shows 0 selected.

Logs

No response

@NasrALdaya
Copy link

It seems like the same problem as issue 2028

@rdjanuar
Copy link
Collaborator

rdjanuar commented Nov 8, 2024

I suggest using by when your v-model is an object or an array of objects. This is because this component currently doesn't work when comparing objectA === objectB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
3 participants