New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async transition hooks #26
Comments
What is the use case behind Ember's |
Is there ever a time in a transition hook when we don't know immediately if we need to |
OK, so thinking about this a bit more: There may be instances where devs want to do something async before transitioning to a component like loading code/data from a server. So let's keep this async for now. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The current implementation of
Router.dispatch
waits for all async transition hooks to resolve before updating the UI. The result ofwillTransitionTo
hooks is also stored off in thecurrentContext
property of routers so that it can be used in components. This is similar Ember'sbeforeModel
andmodel
hook.In a discussion with @rpflorence this morning, we determined that in the Flux model this method of fetching data from the server doesn't really fit. Components that need model data register to get them from stores as they are mounted. When they are first mounted, if they don't have their data yet, they can show some "loading..." UI. As the store gets the data, the components update. This also has the great benefit of immediately updating the UI in response to user action, which is critical. So we should probably remove the context stuff.
Thus, the primary purpose of transition hooks becomes simply aborting or redirecting the transition. The question is: is there ever a time when we need to asynchronously determine which of these actions to take?
The text was updated successfully, but these errors were encountered: