Skip to content

Commit 305c4bf

Browse files
author
Guillaume Chau
committed
fix: remove last route restore
1 parent 2bd5b4f commit 305c4bf

File tree

2 files changed

+4
-29
lines changed

2 files changed

+4
-29
lines changed

packages/@vue/cli-ui/src/main.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,4 @@ const app = new Vue({
2525
...App
2626
})
2727

28-
async function start () {
29-
app.$mount('#app')
30-
31-
// Restore last route
32-
const lastRoute = localStorage.getItem('vue-cli-ui.lastRoute')
33-
if (lastRoute) {
34-
router.push(lastRoute)
35-
}
36-
}
37-
38-
start()
28+
app.$mount('#app')

packages/@vue/cli-ui/src/router.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ const router = new Router({
3333
path: '/',
3434
component: ProjectHome,
3535
meta: {
36-
needProject: true,
37-
restore: true
36+
needProject: true
3837
},
3938
children: [
4039
{
@@ -93,18 +92,12 @@ const router = new Router({
9392
{
9493
path: '/project/select',
9594
name: 'project-select',
96-
component: ProjectSelect,
97-
meta: {
98-
restore: true
99-
}
95+
component: ProjectSelect
10096
},
10197
{
10298
path: '/project/create',
10399
name: 'project-create',
104-
component: ProjectCreate,
105-
meta: {
106-
restore: true
107-
}
100+
component: ProjectCreate
108101
},
109102
{
110103
path: '/file-diff',
@@ -150,12 +143,4 @@ router.beforeEach(async (to, from, next) => {
150143
next()
151144
})
152145

153-
router.afterEach((to, from) => {
154-
if (to.matched.some(m => m.meta.restore)) {
155-
localStorage.setItem('vue-cli-ui.lastRoute', to.fullPath)
156-
} else {
157-
localStorage.removeItem('vue-cli-ui.lastRoute')
158-
}
159-
})
160-
161146
export default router

0 commit comments

Comments
 (0)