Skip to content

'Watch route.params' occurs twice when using with pinia store. #1353

Closed
@miyaoka

Description

@miyaoka

Version

4.0.14

Reproduction link

codesandbox.io

Steps to reproduce

  • Open the console.
  • Click 'page1' link.
  • Click 'home' link. (Page component unmounted)
  • Click 'page1' again. Then 'watch route.params' called twice (once is called before setup).
  • Then click 'page2' and it will be called twice as well.
--created page component-- 
useRoute.params: {pageId: "1"} undefined
$route.params: {pageId: "1"} undefined
useRoute.params: {} {pageId: "1"}
$route.params: {} {pageId: "1"}
--unmounted page component-- 
useRoute.params: {pageId: "1"} {} // <- twice called.
--created page component-- 
useRoute.params: {pageId: "1"} undefined  // <- twice called.
$route.params: {pageId: "1"} undefined

What is expected?

watch occurs only once.

What is actually happening?

watch occurs twice.


If you don't use pinia store with useRoute and watch, then works correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    externalThis depends on an external dependency but is kept opened to track it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions