Skip to content

Commit d49ca1d

Browse files
chore(view): Add variable type, braces, comment
1 parent 7eb0998 commit d49ca1d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/view/view.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,14 @@ export class ViewService {
147147
// Given a depth function, returns a compare function which can return either ascending or descending order
148148
const depthCompare = curry((depthFn, posNeg, left, right) => posNeg * (depthFn(left) - depthFn(right)));
149149

150-
const matchingConfigPair = uiView => {
150+
const matchingConfigPair = (uiView: ActiveUIView) => {
151151
let matchingConfigs = this.viewConfigs.filter(matches(uiView));
152-
if (matchingConfigs.length > 1)
152+
if (matchingConfigs.length > 1) {
153+
// This is OK. Child states can target a ui-view that the parent state also targets (the child wins)
154+
// Sort by depth and return the match from the deepest child
155+
// console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs);
153156
matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending
157+
}
154158
return [uiView, matchingConfigs[0]];
155159
};
156160

0 commit comments

Comments
 (0)