Closed
Description
Version
4.0.14
Reproduction link
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.