Skip to content

Commit

Permalink
fix: read id from hash param only when we we never read it or maintai…
Browse files Browse the repository at this point in the history
…nSelection is tru
  • Loading branch information
megheaiulian committed Jan 28, 2021
1 parent e851d3b commit a6cfd4a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cosmoz-data-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -973,16 +973,21 @@ class CosmozDataNav extends hauntedPolymer('haunted', useDataNav)(PolymerElement
return;
}

if (this._readFromHashOnce && !this.maintainSelection) {
return;
}

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

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

this._readFromHashOnce = true;
this.selected = selection;
return true;
}

}
customElements.define('cosmoz-data-nav', CosmozDataNav);

0 comments on commit a6cfd4a

Please sign in to comment.