Skip to content

Commit abf5cab

Browse files
committed
fix: avoid race conditions when fetching background trace
1 parent 95bd36c commit abf5cab

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

front_end/entrypoints/main/MainImpl.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,12 @@ export class MainImpl {
569569
// would request and evaluate the Timeline panel dep tree, slowing down the UI's load.
570570
const Timeline = await import('../../panels/timeline/timeline.js');
571571
Timeline.TimelinePanel.LoadTimelineHandler.instance().handleQueryParam(value);
572+
} else {
573+
const panel = Root.Runtime.Runtime.queryParam('panel');
574+
if (panel === 'timeline') {
575+
// [RN] If panel is specified, we need Timeline to be ready and be subscribed to the events that will be emitted.
576+
await import('../../panels/timeline/timeline.js');
577+
}
572578
}
573579

574580
// Initialize ARIAUtils.alert Element

front_end/panels/timeline/TimelineController.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,11 @@ export class TimelineController implements Trace.TracingManager.TracingManagerCl
203203
}
204204

205205
async rnPrepareForTraceCapturedInBackground(): Promise<void> {
206-
await LiveMetrics.LiveMetrics.instance().disable();
207-
208206
if (this.tracingManager) {
209207
this.tracingManager.rnPrepareForTraceCapturedInBackground(this);
210208
}
211209

210+
await LiveMetrics.LiveMetrics.instance().disable();
212211
this.client.loadingStarted();
213212
await this.allSourcesFinished();
214213
await LiveMetrics.LiveMetrics.instance().enable();

0 commit comments

Comments
 (0)