Core f2f proposal: simultaneous nested model resolution

First of core face-to-face proposals:

Right now the behavior of model hook resolution when transitioning into a nested route is that a parent route’s model hooks must fully resolve before the child route even begins resolving (and having its model hooks called). This is certainly the safest, most consistent way of resolving models, and it makes sense for this to remain the default, but it means that you can’t (easily) simultaneously resolve models hooks without adopting weird unwieldy patterns, which means even if you have all the information up front to fire all the requests right away (from the url), you are still somewhat forced to sequentially fire these requests.

So, proposal is simple enough: expose a boolean flag on Ember.Route, perhaps called eagerResolve, that essentially tells the router: “don’t wait for my parent route to resolve before attempting to resolve me”

App.EagerRoute = Ember.Route.extend({
  eagerResolve: true, 
  model: function() {
    // this gets called even before the parent 
    // of EagerRoute gets resolved
  }
});

There are some questions about how error handling works in this case but it seems like the solutions to each of these aren’t going to be too surprising or too crazy challenging to implement.

Thoughts?

Sounds good. 99% of the time waiting for the parent is exactly what’s needed in the apps I’ve built, but there is the odd occasion where it’s nice to be able to bypass.

Bike-shedding, but maybe something like waitForParent or needsParent as the name, eagerResolve sounds like it’s this route which is resolving quickly as opposed to the parent.

Very good point.

Probably gonna start on this shortly but it’s easy / I’m happy to swap out the flag name at the last moment.