Subscribe on changes!

some mutation methods of Array cause infinite recursion

avatar
Sep 17th 2020

Version

3.0.0-rc.12

Reproduction link

https://codepen.io/unbyte/pen/ExKePMY

Steps to reproduce

  1. open the terminal

What is expected?

effects should only run one time, cuz no reactive dep has changed

What is actually happening?

infinite recursive update


I've fixed it by #2135 , however it was closed by some misunderstanding.

I've created another PR #2138 to fix it.

This recursion is not due to the self-calls of the effect, but that push changes .length while it depends on .length (however this dependency is not really needed)

avatar
Sep 17th 2020

What about method splice?

avatar
Sep 17th 2020

This is expected since your effect is mutating its dependency.

avatar
Sep 17th 2020

@CyberAP I don't think it's reasonable, operating one array in two effects leads to infinite recursive call, it sounds crazy 😂

avatar
Sep 17th 2020

You'll get the same result in Vue 2, the problem here is with the logic of the code, not with the Vue's API.

avatar
Sep 18th 2020

@CyberAP any repro in Vue 2? 😲

avatar
May 21st 2021

I don't consider it as a bug or something need to fix. That's how it should be. It looks similar to #3653.