Skip to content

watchEffect is called twice on initialisation #2125

Closed
@cexbrayat

Description

@cexbrayat

Version

3.0.0-rc.11

Reproduction link

https://jsfiddle.net/qrh0ubaj/

Steps to reproduce

Consider this component

setup() {
  const price = ref(10);
  const history = ref<Array<string>>([]);
  watchEffect(() => {
    history.value.push(`Price changed to ${price.value}`);
  });
  return { price, history };
}

What is expected?

In rc.10, it only displays one change when initialised (Price changed to 10)

What is actually happening?

In rc.11, it displays this change twice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions