Skip to content

Commit

Permalink
Bypass unresolved route promises in route-debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Tsao committed Jan 3, 2021
1 parent b79f840 commit ce88b8b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ember_debug/route-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ export default EmberObject.extend(PortMixin, {
},
});

/**
*
* @param {*} routeTree
* @param {*} route
* @return {Void}
*/
function buildSubTree(routeTree, route) {
let handlers = route.handlers;
let owner = this.get('namespace.owner');
Expand Down Expand Up @@ -168,6 +174,12 @@ function buildSubTree(routeTree, route) {
// Ember < 3.9.0
routeHandler = routerLib.getHandler(handler);
}

// Skip when route is an unresolved promise
if (typeof routeHandler?.then === 'function') {
continue;
}

controllerName =
routeHandler.get('controllerName') || routeHandler.get('routeName');
controllerFactory = owner.factoryFor
Expand Down Expand Up @@ -227,6 +239,12 @@ function arrayizeChildren(routeTree) {
return obj;
}

/**
*
* @param {*} container
* @param {*} segments
* @return {String}
*/
function getURL(container, segments) {
const locationImplementation = container.lookup('router:main').location;
let url = [];
Expand Down Expand Up @@ -263,6 +281,12 @@ function getURL(container, segments) {
return url;
}

/**
*
* @param {String} owner
* @param {String} name
* @return {Void}
*/
function routeHasBeenDefined(owner, name) {
return (
owner.hasRegistration(`template:${name}`) ||
Expand Down

0 comments on commit ce88b8b

Please sign in to comment.