[ui] Fix stack sampling panel auto-closing when clicking on a slice.
Controller has been assuming that for an area selection, area would
always change, however it's possible to have a controller request
with area selection but without area change (i.e. when clicking on an
individual part of the flamegraph).
Bug: b/227644072
Change-Id: Ib4adb240824f03fb4e9be000ff71a0019fc9ea93
diff --git a/ui/src/controller/flamegraph_controller.ts b/ui/src/controller/flamegraph_controller.ts
index 13f793a..f5c5d60 100644
--- a/ui/src/controller/flamegraph_controller.ts
+++ b/ui/src/controller/flamegraph_controller.ts
@@ -136,11 +136,11 @@
}
this.requestingData = true;
- this.assembleFlamegraphDetails(selection, hasAreaChanged);
+ this.assembleFlamegraphDetails(selection, area !== undefined);
}
private async assembleFlamegraphDetails(
- selection: FlamegraphState, hasAreaChanged: boolean) {
+ selection: FlamegraphState, isInAreaSelection: boolean) {
const selectedFlamegraphState = {...selection};
const flamegraphMetadata = await this.getFlamegraphMetadata(
selection.type,
@@ -189,7 +189,7 @@
this.prepareAndMergeCallsites(
expandedFlamegraphData,
this.lastSelectedFlamegraphState.viewingOption,
- hasAreaChanged,
+ isInAreaSelection,
rootSize,
this.lastSelectedFlamegraphState.expandedCallsite);
}
@@ -221,13 +221,13 @@
private prepareAndMergeCallsites(
flamegraphData: CallsiteInfo[],
viewingOption: string|undefined = DEFAULT_VIEWING_OPTION,
- hasAreaChanged: boolean, rootSize?: number,
+ isInAreaSelection: boolean, rootSize?: number,
expandedCallsite?: CallsiteInfo) {
this.flamegraphDetails.flamegraph = mergeCallsites(
flamegraphData, this.getMinSizeDisplayed(flamegraphData, rootSize));
this.flamegraphDetails.expandedCallsite = expandedCallsite;
this.flamegraphDetails.viewingOption = viewingOption;
- this.flamegraphDetails.isInAreaSelection = hasAreaChanged;
+ this.flamegraphDetails.isInAreaSelection = isInAreaSelection;
this.checkCompletionAndPublishFlamegraph(this.flamegraphDetails);
}