Skip to content

Commit d0fdde9

Browse files
jackfranklinDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
RPP: care about data grid deselect events
This ensures that if the user deselects a row we deal with it correctly. Otherwise the user can visually deselect the row, but the UI does not update to account for that change. Bug: 409474445 Change-Id: Ib89e9e0e9b767411f6d1add45f845c435624ee7d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6443373 Reviewed-by: Andres Olivares <andoli@chromium.org> Commit-Queue: Andres Olivares <andoli@chromium.org> Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
1 parent d811135 commit d0fdde9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

front_end/panels/timeline/TimelineTreeView.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,10 +600,12 @@ export class TimelineTreeView extends
600600

601601
override wasShown(): void {
602602
this.dataGrid.addEventListener(DataGrid.DataGrid.Events.SELECTED_NODE, this.#onDataGridSelectionChange, this);
603+
this.dataGrid.addEventListener(DataGrid.DataGrid.Events.DESELECTED_NODE, this.#onDataGridDeselection, this);
603604
}
604605

605606
override childWasDetached(_widget: UI.Widget.Widget): void {
606607
this.dataGrid.removeEventListener(DataGrid.DataGrid.Events.SELECTED_NODE, this.#onDataGridSelectionChange);
608+
this.dataGrid.removeEventListener(DataGrid.DataGrid.Events.DESELECTED_NODE, this.#onDataGridDeselection);
607609
}
608610

609611
/**
@@ -617,6 +619,17 @@ export class TimelineTreeView extends
617619
this.onHover((event.data as GridNode).profileNode);
618620
}
619621

622+
/**
623+
* Called when the user deselects a row.
624+
* This can either be because they have selected a new row
625+
* (you should expect a SELECTED_NODE event after this one)
626+
* or because they have deselected without a new selection.
627+
*/
628+
#onDataGridDeselection(): void {
629+
this.onClick(null);
630+
this.onHover(null);
631+
}
632+
620633
onGridNodeOpened(): void {
621634
const gridNode = this.dataGrid.selectedNode as TreeGridNode;
622635
// Use tree's hover method in case of unique hover experiences (like ThirdPartyTree).

0 commit comments

Comments
 (0)