kuy / redux-tower

Saga powered routing engine for Redux app.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Early detection of component change for triggering leaving hook

kuy opened this issue · comments

The leaving hooks are triggered when CHANGE_COMPONENT action is dispatched, not URL change.

  1. Open blog example
  2. Login
  3. Go to post edit page
  4. Change title
  5. Click Posts link in navigation
  6. Start loading
  7. Finish loading and dispatch CHANGE_COMPONENT action
  8. 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.