fix(router): load route config from async instructions
Previously, async routes generated from links would not load the configs of their resolved components, which led to broken links in the children of the async instruction's component. This commit fixes the bookkeeping in the Router to correctly load the configs. Fixes internal b/23791558 Closes #4146
This commit is contained in:
@ -249,9 +249,9 @@ export class RouteRegistry {
|
||||
}
|
||||
lastInstructionIsTerminal = lastInstruction.component.terminal;
|
||||
}
|
||||
if (!lastInstructionIsTerminal) {
|
||||
if (isPresent(componentCursor) && !lastInstructionIsTerminal) {
|
||||
throw new BaseException(
|
||||
`Link "${ListWrapper.toJSON(linkParams)}" does not resolve to a terminal instruction.`);
|
||||
`Link "${ListWrapper.toJSON(linkParams)}" does not resolve to a terminal or async instruction.`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,8 @@ export class Router {
|
||||
_settleInstruction(instruction: Instruction): Promise<any> {
|
||||
var unsettledInstructions: Array<Promise<any>> = [];
|
||||
if (isBlank(instruction.component.componentType)) {
|
||||
unsettledInstructions.push(instruction.component.resolveComponentType());
|
||||
unsettledInstructions.push(instruction.component.resolveComponentType().then(
|
||||
(type: Type) => { this.registry.configFromComponent(type); }));
|
||||
}
|
||||
if (isPresent(instruction.child)) {
|
||||
unsettledInstructions.push(this._settleInstruction(instruction.child));
|
||||
|
Reference in New Issue
Block a user