Subscribe on changes!

watchEffect can't watch props when use promise

avatar
Oct 24th 2021

Version

3.2.16

Reproduction link

sfc.vuejs.org/

Steps to reproduce

App.vue set a computed value and as props to Test.vue, but can't trigger watchEffect when use Promise function

What is expected?

can watch props

What is actually happening?

can't watch props

avatar
Oct 24th 2021

I'd say this is to be expected as dependencies can only be collected synchronously.

avatar
Oct 24th 2021

@LinusBorg So i need use "computed" or "watch" to solve it ?

avatar
Oct 24th 2021

You could also make sure to access the dep (refs.name.value) before using await, i.e. by assigning it's value to a local variable.

avatar
Oct 24th 2021

@LinusBorg Thank you😄