Skip to content

Commit 1d615cb

Browse files
authored
[Inspector V2] Fix bug preventing us from capturing initial load time for the V2 inspector (#8900)
1 parent 5d3649d commit 1d615cb

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/devtools_app/lib/src/screens/inspector_v2/inspector_controller.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,12 @@ class InspectorController extends DisposableController
385385
return _waitForPendingUpdateDone();
386386
}
387387

388-
Future<void> refreshInspector() async {
389-
// If the user is force refreshing the inspector before the first load has
390-
// completed, this could indicate a slow load time or that the inspector
388+
Future<void> refreshInspector({bool isManualRefresh = false}) async {
389+
// If the user is manually refreshing the inspector before the first load
390+
// has completed, this could indicate a slow load time or that the inspector
391391
// failed to load the tree once available.
392-
if (!firstInspectorTreeLoadCompleted) {
393-
// We do not want to complete this timing operation because the force
392+
if (isManualRefresh && !firstInspectorTreeLoadCompleted) {
393+
// We do not want to complete this timing operation because the manual
394394
// refresh will skew the results.
395395
ga.cancelTimingOperation(InspectorScreen.id, gac.pageReady);
396396
ga.select(

packages/devtools_app/lib/src/screens/inspector_v2/inspector_screen_body.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class InspectorScreenBodyState extends State<InspectorScreenBody>
107107
addAutoDisposeListener(preferences.inspector.pubRootDirectories, () {
108108
if (serviceConnection.serviceManager.connectedState.value.connected &&
109109
controller.firstInspectorTreeLoadCompleted) {
110-
_refreshInspector();
110+
controller.refreshInspector();
111111
}
112112
});
113113

@@ -152,7 +152,7 @@ class InspectorScreenBodyState extends State<InspectorScreenBody>
152152
InspectorTreeControls(
153153
isSearchVisible: searchVisible,
154154
constraints: constraints,
155-
onRefreshInspectorPressed: _refreshInspector,
155+
onRefreshInspectorPressed: _manualInspectorRefresh,
156156
onSearchVisibleToggle: _onSearchVisibleToggle,
157157
searchFieldBuilder:
158158
() => StatelessSearchField<InspectorTreeRow>(
@@ -219,15 +219,15 @@ class InspectorScreenBodyState extends State<InspectorScreenBody>
219219
_inspectorTreeController.resetSearch();
220220
}
221221

222-
void _refreshInspector() {
222+
void _manualInspectorRefresh() {
223223
ga.select(
224224
gac.inspector,
225225
gac.refresh,
226226
screenMetricsProvider: () => InspectorScreenMetrics.v2(),
227227
);
228228
unawaited(
229229
blockWhileInProgress(() async {
230-
await controller.refreshInspector();
230+
await controller.refreshInspector(isManualRefresh: true);
231231
}),
232232
);
233233
}

0 commit comments

Comments
 (0)