Skip to content

Commit

Permalink
chore: perf improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarpl committed Feb 13, 2024
1 parent f327327 commit 7ef38e2
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/apps/client/src/model/UISegment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,13 @@ export class UISegment {
}

get linesInOrder(): UILine[] {
return Array.from(this.lines.values())
.slice()
.sort((a, b) => a.rank - b.rank)
return Array.from(this.lines.values()).sort((a, b) => a.rank - b.rank)
}

get linesInOrderFiltered(): UILine[] {
return Array.from(this.lines.values())
.slice()
.filter(this.doesLineMatchFilter)
.sort((a, b) => a.rank - b.rank)
let lines = Array.from(this.lines.values())
if (this.owner.filter) lines = lines.filter(this.doesLineMatchFilter)
return lines.sort((a, b) => a.rank - b.rank)
}

private doesLineMatchFilter = (line: UILine): boolean => {
Expand Down

0 comments on commit 7ef38e2

Please sign in to comment.