Subscribe on changes!

`Object.hasOwn()` hinders reactivity

avatar
Sep 22nd 2023

Vue version

3.3.4

Link to minimal reproduction

https://play.vuejs.org/#eNqNUk2P0zAQ/SsjX5JKId3V3qq2CFAPcKAIuNV7cNNJ4uLYlu30Q1H+O+OEdiOxrLj5zXvz/Dyejn2wNj+1yBZs6QsnbQCPobVrrmVjjQvQgUNRBHnCDM4iFPWmLLEI0EPpTAMJNSdcc10Y7QMoU8Hq3pHunmcvXGnMlOv6gZt4pukMVmvouIZolNvW1+kuCa4N9TXJokG+Fw7ewyMs4CF6/69HLfz2rMljuz+SKh9xSo4ZJOSZzP52vV23giSgDwnM52C0uhIcE8FZKgV7hOBkVaHDAwh9iNdW8VgJSS7L+ThXmiiBgI1VIiAhgDuC07vSuBVnqIO7gtTRg7NBRDJvhV53HQzs7uEZ+p5cY/GPYO9elz7+U7qcT5JMAMtY8PRdpazyozea9mIYJWeFaaxU6LY2SPpOzhbjkCMnlDLnL0ONRoPZrV7UWPx6pX70l1jj7JtDj+6EnN25IFyFYaQ3P77ihc53sjGHVpH6DfI7eqPamHGUfWz1gWJPdEPaz8N2S1399JtLQO1vj4pBo7If9JzRfn964+kvcZ/yp6GP1of1vwEYvBxN

Steps to reproduce

Create a reactive object with a property. Within a dependency (computed/watch), check the existence of a property within the reactive variable via Object.hasOwn. Now change the value of the property.

What is expected?

The dependency is supposed to trigger upon change of the property.

What is actually happening?

The dependency does not trigger upon change of the property.

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12900K
    Memory: 49.42 GB / 63.75 GB
  Binaries:
    Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.2283.0), Chromium (117.0.2045.36)
    Internet Explorer: 11.0.22621.1

Any additional comments?

The static method Object.hasOwn is supposed to be the longtime replacement for Object.prototype.hasOwnProperty. Unfortunately, this hinders reactivity with reactive properties. This issue also regards Object.prototype.hasOwnProperty.call as well as Object.hasOwnProperty.call