Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum recursive updates exceeded in component in 3.4.15 #10214

Closed
treardon17 opened this issue Jan 25, 2024 · 8 comments · Fixed by #10232
Closed

Maximum recursive updates exceeded in component in 3.4.15 #10214

treardon17 opened this issue Jan 25, 2024 · 8 comments · Fixed by #10232

Comments

@treardon17
Copy link

treardon17 commented Jan 25, 2024

Vue version

3.4.15

Link to minimal reproduction

https://play.vuejs.org/#eNqNU01v2kAQ/SsjXwA12I1oLxRQmiiV2kOLmh59MfZATL0f2p0lRMj/vbO7QI3bRLl5Z+bNvPfGc0g+a53uHCbTZGZLU2sCi+T0Ipe10MoQHKBUQjvCClpYGyVgwPWDTl6jsUp+KUpS5vlclGbLEB98ymUuSyUtgTZKW5hDheta4tK/hodcAshC4BTCJwA9a348kKnl5iqGGFC4hqYwuFUrng3Q5rIddVuHYdz7xHY4HMF8cUluGAikftrIg2dZ1Mxq+UEodFMQ8gtgVtW7xeEkLkDSXdE4hLadZT7p4R1IcpVER8ai0OmWQexpUJQfEzZPzhrzhE307zx5JNJ2mmVlJRlWYVPvTCqRMqlFdsNlmXGSaoHjSombSfohvf7IBCx14ylaMV4Z9WTRcJc8ORoX5mQc3KEZG5QVGjRvnduDXczu5f6Zf9oR20KWV7SuNz1T/KLqBs0PTTWv8MKcomnU07cQI+PwLKZ8xPL3f+Jbu4+ilgYDs44BVJgNUkzfP3zHPX+fk0JVrjku4oXkT7SqcZ5jLLt1smLanbrA9mvYMf+yv+z9nlDakyhPNLgR6sNC7l6R/pfuJJ10XIzXxB6yg+fTM7juXeXlPdwp/kX4KLhu+D6eC+4Ddu1k6Yf3DiScRiQT+6jVlvFHdvFMfbNQFwS1oSt0Bx4P5d0crjkJDCBnpG/FT5aTtH8AoE2GOg==

Steps to reproduce

Open the link and see the maximum recursion error

What is expected?

No maximum recursion error

What is actually happening?

Maximum recursion error

System Info

System:
    OS: macOS 14.1.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 65.34 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
    pnpm: 8.8.0 - ~/Library/pnpm/pnpm
  Browsers:
    Brave Browser: 120.1.61.120
    Chrome: 120.0.6099.234
    Safari: 17.1

Any additional comments?

I understand that computed properties should not have side effects, and this example does have a side effect, however there are some cases where classes/factories might modify some global reactive state for tracking purposes. In 3.4.14 and before this example works, but this breaks in 3.4.15.

In an ideal world, obviously nobody would ever modify anything inside of a getter, making all getters "pure" functions. I don't know if this is necessarily a realistic requirement in the real world, especially if all previous versions of Vue 3 (whether intentionally or unintentionally) supported this.

I believe other people are possibly running into this issue:
#10210
#10172
#10158

I'm pretty confident that this PR introduced this behavior: #10123

@pdesmarais
Copy link

Got this issue earlier today when updating to 3.4.15. Checking at where this is happening, I don't think I have any side effects from computed values but I do have a reference to an external class which might be causing this. Checking if I can build a repro for this.

@pdesmarais
Copy link

Got this issue earlier today when updating to 3.4.15. Checking at where this is happening, I don't think I have any side effects from computed values but I do have a reference to an external class which might be causing this. Checking if I can build a repro for this.

So, please ignore my previous comment. I fixed the issue on my side. Was actually a simple fix once I understood what was happening.

The only thing I'd say is that even though this is the correct behaviour, this breaks previous behaviour so it should be marked as a breaking change or pushed back to a major release.

@Doctor-wu
Copy link
Member

Doctor-wu commented Jan 27, 2024

@johnsoncodehk I think this is also a question about the computed trigger their deps while getting the effect's value. However, computed will not cause a maximum recursion issue since computed values are lazily calculated, and they are only marked as MaybeDirty. It might be more reasonable if computed, render, and watch all have the same behavior regarding maximum recursion (either all cause it or all do not cause it), WDYT.

@lmc3s3f0r
Copy link

Having a similar issue in a project using with vue-openlayers (I'd like to add a repo to showcase the issue, but the project is quite large and it's tough to add everything), but not with v-for. Just in a prop passed as a ref.

If it helps, I've tried with some versions with these results:
-3.3.4 and 3.4.14: everything works fine
-3.4.13 and 3.4.15: the "Maximum recursive updates exceeded" error appears

@lmc3s3f0r
Copy link

I just tried 3.4.16 and I'm getting the same "Maximum recursive updates eceeded".

@Doctor-wu
Copy link
Member

I just tried 3.4.16 and I'm getting the same "Maximum recursive updates eceeded".

you can commit a new issue and provide a minimal reproduction since this issue is closed

@lizthegrey
Copy link

Confirmed that the fix worked fine for my case.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 29, 2024
lynxlangya pushed a commit to lynxlangya/core that referenced this issue May 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants