Skip to content

Commit

Permalink
make sure _isActive returns boolean in link-to
Browse files Browse the repository at this point in the history
  • Loading branch information
bekzod committed Oct 28, 2017
1 parent 3942c5a commit 5b215f7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/ember-glimmer/lib/components/link-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,19 +556,18 @@ const LinkComponent = EmberComponent.extend({
_isActive(routerState) {
if (get(this, 'loading')) { return false; }

let routing = get(this, '_routing');
let models = get(this, 'models');
let resolvedQueryParams = get(this, 'resolvedQueryParams');
let currentWhen = get(this, 'current-when');

if (typeof currentWhen === 'boolean') {
return currentWhen ? get(this, 'activeClass') : false;
}
if (typeof currentWhen === 'boolean') { return currentWhen; }

let isCurrentWhenSpecified = !!currentWhen;
currentWhen = currentWhen || get(this, 'qualifiedRouteName');
currentWhen = currentWhen.split(' ');

let routing = get(this, '_routing');
let models = get(this, 'models');
let resolvedQueryParams = get(this, 'resolvedQueryParams');

for (let i = 0; i < currentWhen.length; i++) {
if (routing.isActiveForRoute(models, resolvedQueryParams, currentWhen[i], routerState, isCurrentWhenSpecified)) {
return true;
Expand Down

0 comments on commit 5b215f7

Please sign in to comment.