ember-engines icon indicating copy to clipboard operation
ember-engines copied to clipboard

Enter loading substate while waiting for lazy engine to download.

Open kellyselden opened this issue 7 years ago • 7 comments

Given

Router.map(function() {
  this.mount('my-engine');
});

and app/templates/my-engine-loading.hbs, the loading substate only enters after the engine has downloaded. Is it possible to enter the loading substate before the engine starts downloading?

kellyselden avatar Jun 08 '17 21:06 kellyselden

Are you sure that loading substate isn't entered? Or is the transition resolving too quickly? If you verified the above, then we should consider this a bug.

The logic for whether the loading substate is entered starts here and you can see the slowTransitionTimer gets canceled if the transition completes before it fires.

trentmwillis avatar Jun 09 '17 05:06 trentmwillis

I slowed down the network and verified that while the assets are downloading, my previous route template is shown.

kellyselden avatar Jun 09 '17 06:06 kellyselden

Se my comment on the related bug. The substate should be a property of the engine itself, not its host.

nathanhammond avatar Jun 09 '17 07:06 nathanhammond

@nathanhammond I don't think the two issues are related. The other one is concerned with what to do during a blocked model hook in an engine, and this one is waiting for an engine is downloading, so we haven't made it into engine code yet.

Right now it seems like the app is hung on the old route while the engine downloads. It seems like the best thing to do is enter the loading substate during this.

kellyselden avatar Jun 09 '17 21:06 kellyselden

+1 Facing the same issue

siva-sundar avatar Jun 11 '17 10:06 siva-sundar

May be we can have an intermediate transition by triggering _scheduleLoadingEvent here. But _scheduleLoadingEvent requires a routeHandler which will not be available until the engine resources are loaded. Thoughts?

siva-sundar avatar Jun 12 '17 16:06 siva-sundar

@trentmwillis Same here. The loading template shows up until the JavaScript file and CSS file are downloaded.

tigressbailey avatar Jun 12 '18 14:06 tigressbailey