Subscribe on changes!

v-memo doesn't work on v-if and component

avatar
Aug 17th 2022

Vue version

latest

Link to minimal reproduction

https://element-plus.run/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8cD7lnKjmmK/lkKbmmL7npLrkuLp0cnVl5pe2LOi/nue7reaMiTLmrKFcIuWIh+aNouaYvuekuumakOiXj+aMiemSrlwiLOeEtuWQjuWGjeaMiVwi5YqgXCLmjInpkq4sdi1tZW1v6K6h5pWw5LiN5Lya5Y+Y5YyWPC9wPlxuICA8cD7lnKjmmK/lkKbmmL7npLrkuLp0cnVl5pe2LDHmrKFcIuWIh+aNouaYvuekuumakOiXj+aMiemSrlwiLOeEtuWQjuWGjeaMiVwi5YqgXCLmjInpkq4s54S25ZCO5YaN5oyJXCLliIfmjaLmmL7npLrpmpDol4/mjInpkq5cIiwg54S25ZCO5YaN5oyJXCLliqBcIiwgdi1tZW1v55qE6K6h5pWw5Lya5Y+Y5YyWPC9wPlxuICA8ZWwtYnV0dG9uIEBjbGljaz1cInNob3cgPSAhc2hvd1wiPuWIh+aNouaYvuekuumakOiXjzwvZWwtYnV0dG9uPlxuICA8ZWwtYnV0dG9uIEBjbGljaz1cImNvdW50KytcIj7liqA8L2VsLWJ1dHRvbj5cbiAgPHA+5piv5ZCm5pi+56S6Ont7c2hvd319PC9wPlxuICA8cCB2LW1lbW89XCJbY291bnRdXCI+5oiR5LiN5Y+Xdi1pZuaOp+WItizkuJTmmK92LW1lbW/orqHmlbA6e3tjb3VudH19PC9wPlxuICA8cCB2LWlmPVwic2hvd1wiPuaIkeWPl3YtaWborqHmlbAs5L2G5LiN5pivdi1tZW1v6K6h5pWwOnt7Y291bnR9fTwvcD5cbiAgPGJ1dHRvbiB2LW1lbW89XCJbc2hvd11cIj7miJHkuI3mmK/nu4Tku7Ys5oiR5pivdi1tZW1vLOS9huaYr+aIkeeahHYtbWVtb+S4jeaYr+iuoeaVsCzmiJHnmoTorqHmlbDkuI3kvJrmm7Tmlr

Steps to reproduce

<span v-if="show" v-memo="[count]">{{count}}</span> const show = ref(true); const count = ref(0);

1.change show from true to false and to true again 2.change count; 3. will not update


<el-button v-memo="[show]">{{count}}</el-button> const show = ref(true); const count = ref(0);

1.keep show === true 2.change count; 3. will update

What is expected?

v-memo work on v-if and component

What is actually happening?

v-memo doesn't work on v-if and component

System Info

No response

Any additional comments?

No response

avatar
Aug 19th 2022

Your reproduction is not minimal, please read and follow https://new-issue.vuejs.org/?repo=vuejs/vue-next#why-repro when reporting a bug. Most bugs should be reproducible with the SFC Playground.