Skip to content

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

Closed
@Mini-ghost

Description

@Mini-ghost

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.regressionscope: reactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions