Skip to content

Commit 4bdce47

Browse files
fix(lazyLoad): Wait for future state to be replaced before registering lazy children
Closes #46 Closes #40 Closes angular-ui/ui-router#3375
1 parent 8b47c9d commit 4bdce47

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/state/stateBuilder.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,10 @@ export class StateBuilder {
281281
build(state: StateObject): StateObject {
282282
let {matcher, builders} = this;
283283
let parent = this.parentName(state);
284-
if (parent && !matcher.find(parent)) return null;
284+
285+
if (parent && !matcher.find(parent, undefined, false)) {
286+
return null;
287+
}
285288

286289
for (let key in builders) {
287290
if (!builders.hasOwnProperty(key)) continue;

src/state/stateMatcher.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class StateMatcher {
1313
}
1414

1515

16-
find(stateOrName: StateOrName, base?: StateOrName): StateObject {
16+
find(stateOrName: StateOrName, base?: StateOrName, matchGlob = true): StateObject {
1717
if (!stateOrName && stateOrName !== "") return undefined;
1818
let isStr = isString(stateOrName);
1919
let name: string = isStr ? stateOrName : (<any>stateOrName).name;
@@ -23,7 +23,7 @@ export class StateMatcher {
2323

2424
if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {
2525
return state;
26-
} else if (isStr) {
26+
} else if (isStr && matchGlob) {
2727
let _states = values(this._states);
2828
let matches = _states.filter(state =>
2929
state.__stateObjectCache.nameGlob &&

0 commit comments

Comments
 (0)