Skip to content

Commit

Permalink
fix: mark hash params as read when hash value is empty
Browse files Browse the repository at this point in the history
An improvement for #144 when hash param is empty on first read
  • Loading branch information
megheaiulian committed Feb 11, 2021
1 parent e642751 commit 37dbc17
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cosmoz-data-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -978,15 +978,22 @@ class CosmozDataNav extends hauntedPolymer('haunted', useDataNav)(PolymerElement
}

const path = ['_routeHashParams', hashParam],
hashValue = this.get(path),
selection = this.items.findIndex(i => this._getItemId(i) === hashValue);
hashValue = this.get(path);

if (!hashValue) {
this._readFromHashOnce = true;
return;
}

const selection = this.items.findIndex(i => this._getItemId(i) === hashValue);

if (selection < 0 || selection === this.selected) {
return;
}
this._readFromHashOnce = true;
this.selected = selection;
return true;

}

}
Expand Down

0 comments on commit 37dbc17

Please sign in to comment.