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

The computed will continuously recompute if it doesn’t track any reactive data. #12337

Open
Mini-ghost opened this issue Nov 6, 2024 · 1 comment · May be fixed by #12341
Open

The computed will continuously recompute if it doesn’t track any reactive data. #12337

Mini-ghost opened this issue Nov 6, 2024 · 1 comment · May be fixed by #12341
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. regression scope: reactivity

Comments

@Mini-ghost
Copy link
Contributor

Mini-ghost commented Nov 6, 2024

Vue version

3.5.12

Link to minimal reproduction

❌ NOT WORK minimal reproduction - 3.5.12
✅ WORK minimal reproduction - 3.5.5

Steps to reproduce

  1. Type g in the <input> element on the screen.
  2. Check the developer tools to see if run 1730889072865 (timestamp as of the current time) is logged.
  3. Delete g and re-enter g.
  4. Check the developer tools again; you’ll see run 1730889075430 logged once more. However, since this computed doesn’t track any reactive data, it should not be updating here.

What is expected?

2024-11-06.10.57.55.mov

When we roll back to version 3.5.5 and repeat the steps above, in step 4, checking the developer tools reveals that the computed does not recompute, this is the expected behavior.

What is actually happening?

2024-11-06.10.57.28.mov

The computed property recalculates each time the condition is toggled.

System Info

System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M1
    Memory: 81.59 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.1 - ~/.nvm/versions/node/v20.12.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.12.1/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v20.12.1/bin/npm
    pnpm: 9.10.0 - ~/.nvm/versions/node/v20.12.1/bin/pnpm
  Browsers:
    Edge: 130.0.2849.68
    Safari: 17.6
    Safari Technology Preview: 18.0
  npmPackages:
    vue: ^3.5.12 => 3.5.12

Any additional comments?

No response

@edison1105
Copy link
Member

related PR #11931

@edison1105 edison1105 added the 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. label Jan 7, 2025
@jh-leong jh-leong marked this as a duplicate of #12857 Feb 12, 2025
@jh-leong jh-leong marked this as a duplicate of #13011 Mar 9, 2025
thecodewarrior added a commit to DFStudio/vue-class-store that referenced this issue Mar 20, 2025
This is a Vue issue (vuejs/core#12337), where computed refs that have no reactive dependencies will be recomputed every time. The issue was masked by the access of `instance[vueStoreWatchScope]` in the watch code, but Reactive doesn't use watches, so it was still encountering the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. regression scope: reactivity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants