Open
Description
Vue version
3.5.13
Link to minimal reproduction
Steps to reproduce
Create a data/computed in the Options API. In the computed access the previous
value.
export default {
data() {
return {
msg: 'Example message'
}
},
computed: {
test(previous) {
console.log(previous);
return this.msg;
}
}
}
What is expected?
The previous
in the computed, should return the actual previous value of the computed.
What is actually happening?
The previous
variable has the Component instance.
System Info
System:
OS: Linux 6.8 Linux Mint 22.1 (Xia)
CPU: (12) x64 13th Gen Intel(R) Core(TM) i7-1365U
Memory: 12.81 GB / 30.99 GB
Container: Yes
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm
pnpm: 9.15.0 - ~/.local/share/pnpm/pnpm
Browsers:
Chrome: 134.0.6998.165
npmPackages:
vue: ^3.4.31 => 3.5.13
Any additional comments?
I wanted to improve the performance of my components in the Options API. That's when I read about getting the previous value that can be a performance optimization when using Objects/Arrays.
This issue does not occur in the Composition API.