create and (trying to) fix async loading of Routes #19456
create and (trying to) fix async loading of Routes #19456sly7-7 wants to merge 2 commits intoemberjs:failing-test-case-for-enginesfrom
Conversation
|
Chatted a bit with @sly7-7 about this in discord this morning, the conclusion we came to was that Ember should never attempt to enter into a loading or error route that itself is not loaded. I believe that @sly7-7 is going to update this code: ember.js/packages/@ember/-internals/routing/lib/system/router.ts Lines 1411 to 1416 in b945e5c Check that Something like: function routeHasBeenDefined(owner: Owner, router: any, localName: string, fullName: string) {
let routerHasRoute = router.hasRoute(fullName);
if (routeHasRoute && !isPromise(router.getRoute(fullName))) {
let ownerHasRoute =
owner.hasRegistration(`template:${localName}`) || owner.hasRegistration(`route:${localName}`);
return ownerHasRoute;
}
return false;
} |
cf582e6 to
0fba94d
Compare
| assert.ok(true, '/posts/1 has been handled'); | ||
| let router = this.applicationInstance.lookup('router:main'); | ||
| run(() => router.send('editPost')); | ||
| await runLoopSettled(); |
There was a problem hiding this comment.
@rwjblue I have doubt about that artificial synchronisation
| }); | ||
| } | ||
|
|
||
| ['@test What about loading states'](assert) { |
There was a problem hiding this comment.
Just a reminder to me, to remove this test
| import { isDestroying } from '@glimmer/destroyable'; | ||
| import RSVP from 'rsvp'; | ||
|
|
||
| export default class LazyRouter extends Router { |
There was a problem hiding this comment.
Not sure if the name fits well.
|
@rwjblue Hi, so I've played with that PR, and I'm blocked, mainly because I miss knowledge on the testing infrastructure, and also when it comes to engines. |
|
Is this still relevant? |
|
@kategengler I'm sorry I didn't notice your question until now 😞 I don't know if this is still relevant, as far as I remember, an error could happen when a route is loaded by an engine. |
|
I'm still seeing this |
This is a follow up of #19266