mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08: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:
committed by
Andrew Kushnir
parent
67d4449db4
commit
1cb113cdec
+1
-1
@@ -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)"
|
||||
|
||||
+4
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user