Skip to content

Commit

Permalink
fix(trace): Fix null reference in uiview name sort function
Browse files Browse the repository at this point in the history
Closes #100
  • Loading branch information
christopherthielen committed Dec 23, 2017
1 parent c9b1a52 commit 59cb067
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/common/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,13 @@ export class Trace {
/** @internalapi called by ui-router code */
traceViewSync(pairs: ViewTuple[]) {
if (!this.enabled(Category.VIEWCONFIG)) return;
const uivheader = 'uiview component fqn';
const cfgheader = 'view config state (view name)';
const mapping = pairs.map(({ uiView, viewConfig }) => {
const uiv = uiView && uiView.fqn;
const cfg = viewConfig && `${viewConfig.viewDecl.$context.name}: ${viewConfig.viewDecl.$name}`;

return { 'ui-view fqn': uiv, 'state: view name': cfg };
}).sort((a, b) => a['ui-view fqn'].localeCompare(b['ui-view fqn']));
const cfg = viewConfig && `${viewConfig.viewDecl.$context.name}: (${viewConfig.viewDecl.$name})`;
return { [uivheader]: uiv, [cfgheader]: cfg };
}).sort((a, b) => (a[uivheader] || '').localeCompare(b[uivheader] || ''));

consoletable(mapping);
}
Expand Down
7 changes: 3 additions & 4 deletions src/view/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,15 @@ export class ViewService {
const uiViewTuples = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair);
const matchedViewConfigs = uiViewTuples.map(tuple => tuple.viewConfig);
const unmatchedConfigTuples = this._viewConfigs
.filter(config => inArray(matchedViewConfigs, config))
.filter(config => !inArray(matchedViewConfigs, config))
.map(viewConfig => ({ uiView: undefined, viewConfig }));

const allTuples: ViewTuple[] = uiViewTuples.concat(unmatchedConfigTuples);

uiViewTuples.forEach(configureUIView);

const allTuples: ViewTuple[] = uiViewTuples.concat(unmatchedConfigTuples);
this._listeners.forEach(cb => cb(allTuples));
trace.traceViewSync(allTuples);
};
}

/**
* Registers a `ui-view` component
Expand Down

0 comments on commit 59cb067

Please sign in to comment.