From 6dce2632c82f6053054854752089e95e03391eb3 Mon Sep 17 00:00:00 2001 From: Laurent Nguyen Date: Wed, 21 Jan 2026 17:28:08 +0100 Subject: [PATCH] fix: prevent race condition by initializing scenario tracking after config is set (#2339) Co-authored-by: Laurent Nguyen --- src/Main.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Main.tsx b/src/Main.tsx index af3d462a7..c90f016ac 100644 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -105,9 +105,12 @@ const App = (): JSX.Element => { // Scenario-based health tracking: start ApplicationLoad and complete phases. const { startScenario, completePhase } = useMetricScenario(); React.useEffect(() => { - startScenario(MetricScenario.ApplicationLoad); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + // Only start scenario after config is initialized to avoid race conditions + // with message handlers that depend on configContext.platform + if (config) { + startScenario(MetricScenario.ApplicationLoad); + } + }, [config, startScenario]); React.useEffect(() => { if (explorer) {