-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
v-model assigner is cached #923
Comments
I don't really understand why you'd write code that is shown in the repro, but that's not how |
Believe it or not, it came naturally while building a reusable component that wraps an Problem 1, cached assignFor the cached function MyComp(props) {
return <input v-model='props.model.name' />;
} If yes, what would the code look like? Problem 2, multiple listenersDocumentation is very explicit about how |
Yeah, this does expose a problem that can happen even in compiled usage. Although I still strongly suggest not relying on any of the internals / undocumented exports. They may break without notice in any release. |
@yyx990803 what's the recommended way to write a renderer that creates a |
Version
3.0.0-alpha.11
Reproduction link
https://jsfiddle.net/an4cbzd9/4/
Steps to reproduce
This very specific and I know how to work around it but I'm reporting it anyway:
The assigner used by v-model is cached during
onBeforeMount
and not updated duringonUpdate
.If you assign
onUpdate:modelValue
manually, it won't reflect changes.Bonus bug:
getModelAssigner
doesn't expect an array (i.e. more than on listener under the keyonUpdate:
). It crashes if you register additional listeners.Easiest fix seems to be not caching
assign
inonBeforeUpdate
and callgetModelAssigner
inonUpdate
. It currently doesn't do much anyway.What is expected?
When you type in the textbox, an id is logged in console.
This id should change everytime you click on the button.
What is actually happening?
Id stays the same, even after clicking the button.
The text was updated successfully, but these errors were encountered: