ember-engines
ember-engines copied to clipboard
Wrong loading substate is entered.
Given
Router.map(function() {
this.mount('my-engine');
});
and
app/templates/loading.hbs
app/templates/my-engine-loading.hbs
Only loading.hbs
renders while waiting for my-engine
. Shouldn't it render my-engine-loading.hbs
?
wouldn't it be app/templates/my-engine/loading.hbs
?
@knownasilya Not according to https://guides.emberjs.com/v2.13.0/routing/loading-and-error-substates/
It's important to note that for slow-model itself, Ember will not try to find a slow-model.loading template
I should also note that when I turn the this.mount
into this.route
, it loads the correct template app/templates/my-engine-loading.hbs
.
@kellyselden seems like a legit bug. The loading/error substates/routes have been a mess for a long time. We tried cleaning them up last year but looks like we missed this edge case.
I'd recommend adding a failing test here and (if you feel up to it) looking into fixing (which will probably be around here).
Even though the changes will be upstream, we can keep this issue for tracking.
This would need to be application-loading
as part of the engine and hoisted from the engine to it's host. It can't load asynchronously and this was an active design decision we made. (Don't know where the documentation for that decision is anymore.) It definitely does not live outside of the engine's namespace as you have described, @kellyselden.
Try it inside of the engine namespace to see if we fully accounted for it or didn't finish implementation.
(Obviously possible to revisit this decision, just trying to provide context.)
I don't remember the original decision making process, but I believe it was wrong. A host application should be able to provide a custom loading substate for when an Engine is loading.
I agree with @trentmwillis. It seems like it would make sense for an engine consumer to not depend on an engine to handle the loading substate, and to provide a "fallback" of sorts. It would also put an engine more in line with how routes work, which is a good thing IMO.
I also ran into related issues/confusion on loading sub-states, but eventually got my engine working after ready @nathanhammond comment. Using application-loading.hbs
within the engine, itself works. Although, following the guides, it seems you can have loading.hbs
or application-loading.hbs
, but loading.hbs
does not work in an engine it seems.
Also,
A host application should be able to provide a custom loading sub-state for when an Engine is loading.
My first inclination was to ONLY have the engine provide its own loading states, but I could see both ways though. Is the goal to keep allowing engines to provide a loading sub-state, and provide a way for the host application to "override" the engine's sub-state, either automatically or through some config?
Just want to confirm whether this issue is fixed.