Skip to content

Commit b5c968e

Browse files
fix: create a new SSR router history for each router instance (#1229)
1 parent 2716506 commit b5c968e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/guide/ssr/routing.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ import MyUser from './components/MyUser.vue'
1313

1414
const isServer = typeof window === 'undefined'
1515

16-
const history = isServer ? createMemoryHistory() : createWebHistory()
16+
const createHistory = isServer ? createMemoryHistory : createWebHistory
1717

1818
const routes = [{ path: '/user', component: MyUser }]
1919

2020
export default function() {
21-
return createRouter({ routes, history })
21+
return createRouter({
22+
history: createHistory(),
23+
routes
24+
})
2225
}
2326
```
2427

0 commit comments

Comments
 (0)