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

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

Closed
miyaoka opened this issue Mar 23, 2022 · 1 comment
Closed

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

miyaoka opened this issue Mar 23, 2022 · 1 comment
Labels
external This depends on an external dependency but is kept opened to track it

Comments

@miyaoka
Copy link
Contributor

miyaoka commented Mar 23, 2022

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.

@posva
Copy link
Member

posva commented Mar 23, 2022

This will be fixed by vuejs/core#5575

The regression was introduced in vue@3.2.30 so you can use the precedent version until a new one is released.

@posva posva closed this as completed Mar 23, 2022
@posva posva added the external This depends on an external dependency but is kept opened to track it label Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external This depends on an external dependency but is kept opened to track it
Projects
None yet
Development

No branches or pull requests

2 participants