Skip to content

Commit

Permalink
fix(Path View): 🐛 Fix extra arrows showing on shorter paths
Browse files Browse the repository at this point in the history
I was mutating the paths when padding them, now I'm using a clone
  • Loading branch information
SkepticMystic committed Aug 3, 2021
1 parent 4a77bb2 commit 8c71661
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/sharedFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,17 @@ export async function openOrSwitch(
}

export function padArray(arr: any[], finalLength: number, filler = ""): any[] {
const currLength = arr.length;
const copy = [...arr];
const currLength = copy.length;
if (currLength > finalLength) {
throw new Error("Current length is greater than final length");
} else if (currLength === finalLength) {
return arr;
return copy;
} else {
for (let i = currLength; i < finalLength; i++) {
arr.push(filler);
copy.push(filler);
}
return arr;
return copy;
}
}

Expand Down

0 comments on commit 8c71661

Please sign in to comment.