-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[FEATURE ember-routing-loading-error-substates] Named substate entry #3655
Conversation
Demonstration of top level error/loading states (3): |
At a glance this seems ok. |
D'oh, wrong button. |
This is for the `ember-routing-loading-error-substates` feature. The `loading` action will now always bubble to `ApplicationRoute`; the logic for preventing substate entry into a substate above the pivot route has been moved default action handlers that live "above" `ApplicationRoute`. /cc krisselden
- When looking for an appropriate substate to enter, the router will first try and find a loading substate sibling with the name of router that the error/loading action emanated from, e.g. if foo route returns a slow promise and both foo_loading and loading routers have been defined (via route class or template), the foo_loading substate will be preferred and entered over plain ol' loading, whereas a slow promise from 'bar' route would enter the more generalized 'loading' route (assuming 'bar_loading' route wasn't defined) - Top-level error/loading substates can now be entered. They are top-level, which means they get rendered as siblings to ApplicationView vs within ApplicationView's outlet. This handles slow/rejecting promises returned from ApplicationRoute. If a route class/template corresponding to 'application_error' or 'application_loading' is found, it will be entered. This may seem like a special-casing of the substate naming conventions, but is actually consistent with the useful rule established in (2) above: Ember will say "ok, slow/rejecting promise came from the 'application' route, let's check if a specifically named 'error' or 'loading' substate exists for it and enter it if so". The only special-casing is that it won't go to the second step of generalizing and looking for routes named specifically 'loading'/'error' to enter, since that corresponds to child substates of the internal this.resource('application')
As discussed, I've split this into two commits, one beta bugfix and one new feature. |
[FEATURE ember-routing-loading-error-substates] Named substate entry
We are all very excited about this feature, but don't feel comfortable with the naming conflict in globals mode. At the core team meeting, we decided that we need to defer merging this in until we have some way of internally detecting whether the Ember app is in "globals" mode or "modules" mode, and only opt-in to this behavior in the modules case. Action Item: Me and @stefanpenner are going to discuss how to handle module mode + new semantics next week. |
@@ -403,9 +403,10 @@ if (Ember.FEATURES.isEnabled("ember-routing-loading-error-substates")) { | |||
App.MomSallyRoute = Ember.Route.extend({ | |||
model: function() { | |||
step(1, "MomSallyRoute#model"); | |||
throw { | |||
|
|||
return Ember.RSVP.reject({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yuno reject with error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't need to strictly be Error
to invoke the behavior being tested
EDIT:
I ended up splitting this PR into two commits; a beta BUGFIX and a new feature. The Feature will be for 1.3, the bugfix should be merged into beta ASAP. Please read the individual commit messages for what's been changed.