Hey! I seem to be missing something about how Error Substates work, so was hoping someone (shout out to @machty) might be able to clarify what the expected behaviour is. I’ve read the page in the guides about it but I’m getting some behaviour that I don’t understand.
What I don’t understand is what should be happening to models of active routes at the point that an error occurs? Should I still be able to access these models in Route
objects using this.modelFor('foo')
? Or does the error mean models for active routes are removed?
Say I’ve got this route scenario: /foo/bar/baz
and I’ve created a BarErrorRoute
object. When an error occurs during the transition into baz
, bar.error
is being transitioned into. However, within BarErrorRoute
, if I use this.modelFor('bar')
or this.modelFor('foo')
, both return undefined - even though the models have been set on their controllers - e.g. this.controllerFor('foo').get('model')
returns the correct model.
I get the same problem when I pivot… so if I’ve entered foo/bar/foobar
and all’s ok, all the models have resolved and it’s rendered. If I transition to foo/bar/baz
and the error occurs, the models for the foo
and bar
routes return undefined
for this.modelFor
.
At the same time, I’m finding that the model for application
is also disappearing - including being removed from the application’s controller. This completely breaks my application. It’s presumably something to do with the error bubbling all the way up to the application, but I don’t see why the model should suddenly disappear from the application’s controller.
So my question on the design is… what is happening with models that have already been resolved on parent routes when an error is encountered? Should I still be able to access them?