Early detection of component change for triggering leaving hook
kuy opened this issue · comments
Yuki Kodama commented
The leaving hooks are triggered when CHANGE_COMPONENT
action is dispatched, not URL change.
- Open blog example
- Login
- Go to post edit page
- Change title
- Click Posts link in navigation
- Start loading
- Finish loading and dispatch
CHANGE_COMPONENT
action - Detect it and trigger leaving hook
This behavior is correct, but I want to run the leaving hook without waiting the load.
If a route action is simple (this means that it doesn't contain if-else statements), the tower can detect before running it and trigger the leaving hook, because the action is just a generator function.