kitze / mobx-router

A simple router for MobX + React apps
509 stars 66 forks source link

beforeExit and beforeEnter hooks not run when new view is a subpage of the old one #32

Closed vencax closed 6 years ago

vencax commented 7 years ago

FROM MAIL:

Hi Kristijan,
simple and quick question: why running beforeExit and beforeEnter hooks are not run when rootViewChanged === false which is: when the new has the old one as a subpath? I havenot found the reason and I have a scenario that depend on this.

I have fixed this with changing this line with:

const rootViewChanged = !this.currentView || (this.currentView !== view);
tomaash commented 6 years ago

My forked package fixes this problem. Until https://github.com/kitze/mobx-router/pull/56 get merged, feel free to use https://www.npmjs.com/package/mobx-router-3