Open ivan-kleshnin opened 9 years ago
I had this problem also; I had to use startWith
to issue an initial event. This is router5's behaviour, but I might flag this as something to add in myself. I'm in the middle of completely rewriting the driver to properly support router5 features and to allow for scoping support (as per cycle/core issue 167).
Here's what I'm exposing in my own code in my router.js file:
function getRouterActions(router) {
return {
route$: router.addListener()
.startWith({ toState: router.matchPath(location.pathname) })
.map(change => {
log.trace(`Route changed to ${change.toState.name}`);
return {
name: change.toState.name,
};
}),
router$: Rx.Observable.just('start').delay(100)
};
}
Direct browser access to
/about
results indefaultRoute
applied. Only JS navigation works.So router basically is not aware that it's alredy "other" page and navigation event had to be sent...
Following http://router5.github.io/docs/api-reference.html It seems that
startPathOrState
fromrouter5.start([startPathOrState], [done])
should be used.However
seems to has no effect.
I can surely debug this but maybe you'll answer quicker.