Closed
Description
Here's what I think of the current API:
- The current list of hooks is a bit overwhelming. Do we actually need
canActivate
andcanDeactivate
? It seemsactivate
anddeactivate
can already handle most use cases withtransition.abort()
andtransition.redirect()
. - The
data
hook name is not that self-explanatory. - The way we determine the async-ness of these hooks is convoluted. Sync, Promises, callbacks... we should try to simplify it.
Idea
Some potential breaking changes for 0.8.0:
- Remove
canActivate
andcanDeactivate
. - (Maybe?) Remove
canReuse
. The same component is always reusable. Handle route change inonChange
. - Rename hooks, now we have just 3 of them:
onEnter
: whatactivate
used to be.onLeave
: whatdeactivate
used to be.onChange
: whatdata
used to be. The new name better explains when it is called (on every route change when the current component is active)
- In addition: allow specifying
onEnter
andonLeave
in the route config as well. - Open to suggestion: how do we simplify hook async-ness?