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

Changes to unrelated ref causes v-model.lazy input to reset #4182

Closed
KrakerXyz opened this issue Jul 23, 2021 · 1 comment
Closed

Changes to unrelated ref causes v-model.lazy input to reset #4182

KrakerXyz opened this issue Jul 23, 2021 · 1 comment

Comments

@KrakerXyz
Copy link

Version

3.1.5

Reproduction link

https://codesandbox.io/s/recursing-keller-edvtl?file=/package.json

Steps to reproduce

See codesandbox example for minimum reproduction. Within this example, there's a setInterval running that increments the 'count' ref every one second. We also have a input bound to 'someNumber' using v-model.lazy.

If you begin typing into the input, you'll see that every time the interval ticks, it causes the input to reset it's value to that of the someNumber value.

What is expected?

Asynchronous changes to unrelated refs should not cause a lazily bound input to reset to it's v-model value.

What is actually happening?

Changes to an unrelated ref is causing lazily bound inputs to reset any in-progress changes back to the bound ref's value

@huww98
Copy link

huww98 commented Mar 2, 2022

This issue states "changes to unrelated refs should not cause a lazily bound input to reset". But currently changes to related refs are not working too. I guess this is related to the fix in ac74e1d. Is this expected? If so, maybe we should update the doc to mention this.

<script setup>
import { ref } from 'vue'

const msg = ref('not computed yet')
</script>

<template>
  <input v-model.lazy="msg" @focus="msg = 'result'">
</template>

The input value would not change if I focus it.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants