mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
fix(devtools): prevent profiler bars flickering after change detection (#63350)
Without trackBy cdkVirtualFor rerenders full list after in each update PR Close #63350
This commit is contained in:
parent
67d4449db4
commit
1cb113cdec
2 changed files with 5 additions and 1 deletions
|
|
@ -23,7 +23,7 @@
|
|||
[class.drag-scrolling]="dragScrolling()"
|
||||
>
|
||||
<div
|
||||
*cdkVirtualFor="let d of graphData(); let i = index"
|
||||
*cdkVirtualFor="let d of graphData(); let i = index; trackBy: trackByIndex"
|
||||
[ngStyle]="d.style"
|
||||
class="frame-bar"
|
||||
[class.selected]="selectedFrameIndexes().has(i)"
|
||||
|
|
|
|||
|
|
@ -250,6 +250,10 @@ export class FrameSelectorComponent {
|
|||
this._viewportScrollState.scrollLeft - dx * DRAG_SCROLL_SPEED;
|
||||
}
|
||||
|
||||
trackByIndex(index: number): number {
|
||||
return index;
|
||||
}
|
||||
|
||||
private getBarStyles(frame: ProfilerFrame, multiplicationFactor: number): GraphNode {
|
||||
const height = frame.duration * multiplicationFactor;
|
||||
const colorPercentage = Math.max(10, Math.round((height / MAX_HEIGHT) * 100));
|
||||
|
|
|
|||
Loading…
Reference in a new issue