### Version 3.6.5 ### Reproduction link [github.com](https://github.com/zengguirong/vue27-router-composition-bug) ### Steps to reproduce 1. Clone the Github repo 2. Run 'npm install' 3. Run 'npm run dev' and open the broswer 4. Click the first link 5. Click the second link 6. Click the first link one more time ### What is expected? The window alert "onBeforeRouteLeave" only once after step 5 ### What is actually happening? 1. The window alert "onBeforeRouteLeave" after step 5 2. The window alert "onBeforeRouteLeave" after step 6 --- This bug only appears when using keep-alive and composables api. <!-- generated by vue-issues. DO NOT REMOVE -->