1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

fix client/router

This commit is contained in:
nkzawa 2016-10-06 16:08:23 +09:00
parent cb11c7cbc6
commit e51c7eabf1
2 changed files with 4 additions and 5 deletions

View file

@ -26,7 +26,7 @@ export default class Router {
onPopState (e) {
this.abortComponentLoad()
const cur = this.currentComponent
const cur = this.currentComponentData.id
const url = getURL()
const { fromComponent, route } = e.state || {}
if (fromComponent && cur && fromComponent === cur) {
@ -44,7 +44,6 @@ export default class Router {
location.reload()
} else {
this.currentRoute = route || toRoute(location.pathname)
this.currentComponent = data.Component.displayName
this.currentComponentData = data
this.set(url)
}
@ -161,7 +160,7 @@ export default class Router {
if (err) {
if (!cancelled) fn(err)
} else {
const d = { data, id: createUid() }
const d = { ...data, id: createUid() }
// we update the cache even if cancelled
if (!this.components[route]) {
this.components[route] = d

View file

@ -26,8 +26,8 @@ export default class App extends Component {
this.close = router.subscribe(() => {
const state = propsToState({
router,
data: router.currentComponentData
...router.currentComponentData,
router
})
try {