Skip to content

Commit 11e59f8

Browse files
author
Guillaume Chau
committed
fix: refresh page & switching between views doesn't lose selected item
Logic wasn't working as intended in RestoreRoute mixin
1 parent 305c4bf commit 11e59f8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/@vue/cli-ui/src/mixins/RestoreRoute.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ export default function ({
2828

2929
beforeRouteEnter (to, from, next) {
3030
if (lastRoute) {
31-
if (!to.query) {
32-
console.log('lastRoute', lastRoute)
31+
if (!to.params || !Object.keys(to.params).length) {
3332
const { name, params, query } = lastRoute
3433
next({ name, params, query })
3534
return
@@ -45,15 +44,14 @@ export default function ({
4544
},
4645

4746
mounted () {
48-
this.$nextTick(() => {
47+
setTimeout(() => {
4948
this.$_restoreRouteReady = true
50-
})
49+
}, 100)
5150
},
5251

5352
methods: {
5453
replaceBaseRoute () {
5554
if (baseRoute && !isSameRoute(this.$route, baseRoute, false)) {
56-
console.log('replaceBaseRoute')
5755
this.$router.replace(baseRoute)
5856
}
5957
}

0 commit comments

Comments
 (0)