Skip to content

[Docs Fix] Incorrect note about lifecycle hooks in reused components — onUpdated still fires #2516

Closed
@LupinThe1st

Description

@LupinThe1st

Reproduction

https://router.vuejs.org/guide/essentials/dynamic-matching.html#Reacting-to-Params-Changes

Steps to reproduce the bug

  1. Create a Vue 3 + Vue Router project.
  2. Define a dynamic route (/users/:name) and map it to a component (User.vue)
  3. In User.vue, add the onUpdated hook to log changes
  4. Navigate from /users/johnny to /users/jolyne.
  5. Observe that onUpdated is called despite the docs claiming that the lifecycle hooks of the component will not be called.

Expected behavior

The documentation suggests that no lifecycle hooks (including onUpdated) should be called when reusing a component instance during route navigation (e.g., /users/johnny → /users/jolyne).

Actual behavior

onUpdated is triggered when route params change

Additional information

Even if User.vue has an empty (no rendered content), the onUpdated hook will still be triggered during the navigation steps described above.

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