incorrect value in component when append a item by unshift
Vue version
3.3.7
Link to minimal reproduction
Steps to reproduce
- Click the first button to increase the count
- Tap the Hello World! title to append the component to first
What is expected?
Hello World! 3 [btn] 0 1 [btn] 1 2 [btn] 0
What is actually happening?
Hello World! 3 [btn] 1 1 [btn] 0 2 [btn] 0
System Info
No response
Any additional comments?
No response
Expected.
https://vuejs.org/guide/essentials/list.html#maintaining-state-with-key
This default mode is efficient, but only suitable when your list render output does not rely on child component state or temporary DOM state (e.g. form input values).
Stateful child components must use key
to ensure correctness.