Description
Vue version
v3.4.38
Link to minimal reproduction
Steps to reproduce
- Open the Devtools Elements panel.
- Click on the first Checkbox, and notice that the corresponding
<input>
does not show any updates. - Click on the second Checkbox, and observe that the corresponding
<input>
flickers (updates).
2024-08-19.12.28.35.mov
What is expected?
In this straightforward reproduction, the corresponding <input>
DOM should not be updated when clicking on the Checkbox, as there are no updates besides modelValue
.
What is actually happening?
The following code does not update the DOM, which is expected:
<input v-model="checked1" type="checkbox" :value="undefined" />
However, when this code is wrapped into a component, the DOM flickers (updates) every time the Checkbox is clicked.
Checkbox.vue
<script setup lang="ts">
import { computed } from 'vue';
const props = defineProps(['modelValue', 'value']);
const emit = defineEmits(['update:modelValue']);
const modelValueWritable = computed({
get() {
return props.modelValue;
},
set(value) {
emit('update:modelValue', value);
},
});
</script>
<template>
<div>
<input v-model="modelValueWritable" :value="value" type="checkbox">
</div>
</template>
<Checkbox v-model="checked2" />
System Info
System:
OS: macOS 14.5
CPU: (8) arm64 Apple M1
Memory: 80.08 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v20.9.0/bin/yarn
npm: 10.5.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
pnpm: 9.4.0 - ~/.nvm/versions/node/v20.9.0/bin/pnpm
Browsers:
Safari: 17.5
Safari Technology Preview: 17.4
npmPackages:
vue: ^3.4.38 => 3.4.38
Any additional comments?
If the default value for value
is changed to an empty string, this issue does not occur.