Skip to content

Router#resolve inside computed causes re-run during navigation #1130

@glen-84

Description

@glen-84

Version

4.0.11

Reproduction link

codesandbox.io

Steps to reproduce

  1. Click Home and About a few times.
  2. Check the console, and note that the computed is re-triggering on each navigation.

What is expected?

A method like Router#resolve should not have "side-effects". It's not usable inside computed/composition functions, as it causes a re-run.

What is actually happening?

It's causing a re-trigger of the computed method.


I could be wrong, but I think it's because resolve is reading from currentRoute, and currentRoute is being written to during navigation.

Would it be possible to read the values from currentRoute without triggering dependencies?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions