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

Reactive regression on 3.4.15 #10172

Closed
lehni opened this issue Jan 21, 2024 · 3 comments
Closed

Reactive regression on 3.4.15 #10172

lehni opened this issue Jan 21, 2024 · 3 comments

Comments

@lehni
Copy link
Contributor

lehni commented Jan 21, 2024

Vue version

3.4.15

Link to minimal reproduction

https://play.vuejs.org/#eNqNUttqGzEQ/RWhF7c0XhHcvhg3pC2Btg9taQt90ct2NbGV6MZo5BjM/nukXe9641wICKS5njNntOefQqi2CfiSr2KDOtCFdLALHokpuK6TIbaXjjFVU/3mbf9mDIESusFibFubBEs2+wrG+FnvbcvVnklX7sbbkAjUcqixcX1sxxhtdKy6LuzdRzZj/zwadWg0wh2TpgjS5bMSI/tsENhgaoJsMbbanF/s9wWQte1KZKukT1L4Gde2TDy3dahuondZjY6ZPASi5CNxybNcxZZ8QxTiUohGuVymwOgtVg5IuGDFZU4TmBxpC3Pl7eWiel+dfxBKR5r6K4h2/h/9XQTMXSTPio04Iju3gHMEpwABX4t7UvYA+yT2CH8QNctCsfHuWq9PRCnL1AbwZyDt3UNx6vwB7r53PsIE4zDNBprbJ/w3cdcP9QuhYzYRgGpcA/Xhqz8/YJffY9B6lcxhEc8Ef0P0JhWOfdrn5FSmPcnr2H7rdqzd+m+82hG4OAxViA6f+LCQLy+MfqS7qBajiu09Yuwe7Q==

Steps to reproduce

Just open the reproduction and see the recursive updates in action.

What is expected?

The same as on v3.4.14 and lower: Only one update should occur.

What is actually happening?

The getter modifies the state before returning it, and this triggers reevaluation of the getter after the call, getting it caught in an infinite update loop.

System Info

System:
    OS: macOS 14.2.1
    CPU: (14) arm64 Apple M3 Max
    Memory: 308.45 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.6.1 - ~/.nvm/versions/node/v20.6.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v20.6.1/bin/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v20.6.1/bin/npm
    pnpm: 7.30.0 - ~/.nvm/versions/node/v20.6.1/bin/pnpm
    bun: 1.0.11 - ~/.bun/bin/bun
  Browsers:
    Chrome: 120.0.6099.129
    Chrome Canary: 122.0.6225.0
    Firefox Nightly: 113.0a1
    Safari: 17.2.1
    Safari Technology Preview: 17.4

Any additional comments?

I am fairly confident that this regression was introduced by:

#10123 / bcdecb7

@lehni lehni changed the title Reactive regression ob 3.4.15 Reactive regression on 3.4.15 Jan 21, 2024
@Doctor-wu
Copy link
Member

Computed was updated in recent versions, and I believe this is the expected result in your reproduction. You are not supposed to make effects in your computed function.

@haoqunjiang
Copy link
Member

Expected. Such usage is explicitly documented as a bad practice: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free

@haoqunjiang haoqunjiang closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2024
@haoqunjiang
Copy link
Member

Sorry for replying to a locked issue, but I just checked my unread email and found that I had forgotten to give a follow-up. This is no longer an issue since 3.4.16.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants