Skip to content

Commit e51c7ea

Browse files
committed
fix client/router
1 parent cb11c7c commit e51c7ea

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

client/router.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default class Router {
2626

2727
onPopState (e) {
2828
this.abortComponentLoad()
29-
const cur = this.currentComponent
29+
const cur = this.currentComponentData.id
3030
const url = getURL()
3131
const { fromComponent, route } = e.state || {}
3232
if (fromComponent && cur && fromComponent === cur) {
@@ -44,7 +44,6 @@ export default class Router {
4444
location.reload()
4545
} else {
4646
this.currentRoute = route || toRoute(location.pathname)
47-
this.currentComponent = data.Component.displayName
4847
this.currentComponentData = data
4948
this.set(url)
5049
}
@@ -161,7 +160,7 @@ export default class Router {
161160
if (err) {
162161
if (!cancelled) fn(err)
163162
} else {
164-
const d = { data, id: createUid() }
163+
const d = { ...data, id: createUid() }
165164
// we update the cache even if cancelled
166165
if (!this.components[route]) {
167166
this.components[route] = d

lib/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export default class App extends Component {
2626

2727
this.close = router.subscribe(() => {
2828
const state = propsToState({
29-
router,
30-
data: router.currentComponentData
29+
...router.currentComponentData,
30+
router
3131
})
3232

3333
try {

0 commit comments

Comments
 (0)