Skip to content

Commit

Permalink
ancestorKeysForKey always returns an array (#6205)
Browse files Browse the repository at this point in the history
  • Loading branch information
meirish authored Aug 1, 2019
1 parent c07213f commit 0271486
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ui/app/components/key-value-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default Component.extend({
const showCurrent = this.get('showCurrent');
const ancestors = utils.ancestorKeysForKey(baseKey);
const parts = utils.keyPartsForKey(baseKey);
if (!ancestors) {
if (ancestors.length === 0) {
crumbs.push({
label: baseKey,
text: this.stripTrailingSlash(baseKey),
Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/namespace-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default Component.extend({
// gets set as 'lastMenuLeaves' in the ember concurrency task above
menuLeaves: computed('namespacePath', 'namespaceTree', function() {
let ns = this.get('namespacePath');
let leaves = ancestorKeysForKey(ns) || [];
let leaves = ancestorKeysForKey(ns);
leaves.push(ns);
leaves = this.maybeAddRoot(leaves);

Expand Down
2 changes: 1 addition & 1 deletion ui/app/lib/key-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function ancestorKeysForKey(key) {
parentKey = parentKeyForKey(parentKey);
}

return ancestors.length ? ancestors : null;
return ancestors;
}

export default {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/mixins/with-nav-to-nearest-ancestor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default Mixin.create({
navToNearestAncestor: task(function*(key) {
let ancestors = utils.ancestorKeysForKey(key);
let errored = false;
let nearest = ancestors && ancestors.pop();
let nearest = ancestors.pop();
while (nearest) {
try {
let transition = this.transitionToRoute('vault.cluster.secrets.backend.list', nearest);
Expand Down

0 comments on commit 0271486

Please sign in to comment.