Skip to content

[Potential bug]: Production issue with Listbox: modelValue is not defined #1446

Answered by RobinMalfait
KlemenS189 asked this question in Help
Discussion options

You must be logged in to vote

Hey! Thank you for your bug report!
Much appreciated! 🙏

The v-model is a shorthand for :modelValue="x" @update:modelValue="newValue => x = newValue". The issue is that you are giving it a prop directly which is "immutable" in the sense that you can't do props.modelValue = x. What you probably want to do is switch:

- <Listbox v-model="modelValue" @update:modelValue="emitChange">
+ <Listbox :modelValue="modelValue" @update:modelValue="emitChange">

This gets rid of your issue, but you will notice that it doesn't really works. This is because you are using emits('update:modelValue', props.modelValue). So you are firing that update event to the outside world, but you do it with the "old" value…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@KlemenS189
Comment options

Answer selected by KlemenS189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1428 on May 13, 2022 18:11.