Skip to content

script setup: Compiler creates wrong patch flags depending on style of variable assignment. #2972

@Aubyn

Description

@Aubyn

Version

3.0.5

Reproduction link

https://github.com/Aubyn/issue-vue3-reactive-array.git

Steps to reproduce

  1. clone, run yarn and yarn dev in terminal
  2. use assignment 2 to create reactive array, named as receivedData in App.vue
  3. click emit button on the page
  4. DOM view didn't update(why) as receivedData updated
  5. use assignment 1
  6. click emit button
  7. DOM view updates as receivedData updated(why)
/* assignment 1 */
const { receivedData, receiveHandler } = {
  receivedData: reactive([]),
  receiveHandler: function (arg1, arg2) {
    receivedData.push([arg1, arg2]);
  }
};
/* assignment 2 */
const receivedData = reactive([]);
const receiveHandler = function (arg1, arg2) {
  receivedData.push([arg1, arg2]);
};

What is expected?

assignment 1 and assignment 2 trigger DOM update.

What is actually happening?

assignment 1 did trigger DOM update, but assignment 2 didn't.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions