From fda1247ee9657a996da7f018dc6678f4d9aea311 Mon Sep 17 00:00:00 2001 From: Yashas Date: Wed, 9 Sep 2026 12:13:33 +0530 Subject: [PATCH] =?UTF-8?q?fix(console):=20blank=20lead=20page=20=E2=80=94?= =?UTF-8?q?=20statusStrip=20const=20used=20blocked/stalled=20before=20they?= =?UTF-8?q?=20existed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The lifted status strip (e21e394) was defined right after `holds`, but its JSX references `blocked` and `stalled`, which are declared ~80 lines lower. A const that reads a const declared below it throws "Cannot access before initialization" at render — a temporal dead zone the bundler does not catch, so the build passed and the lead page rendered blank. Moved the statusStrip definition to just after `stalled`, so every value it reads exists first. The lifted-above-the-metrics position is unchanged. Co-Authored-By: Claude Opus 4.8 --- src/screens/Lead.jsx | 152 ++++++++++++++++++++++--------------------- 1 file changed, 77 insertions(+), 75 deletions(-) diff --git a/src/screens/Lead.jsx b/src/screens/Lead.jsx index e32a890..fd045dc 100644 --- a/src/screens/Lead.jsx +++ b/src/screens/Lead.jsx @@ -301,81 +301,6 @@ export default function Lead() { const stage = phaseOf(STAGES.find((s) => s.name === stateName), row) const holds = holdsOf(stage) - /* WHAT IS HAPPENING NOW, lifted above the numbers. An operator's first - question about a lead is "what is going on / what do I do", not "what is - the premium" — so the status strip (an alert when blocked or stalled, the - live state otherwise) sits directly under the header, before the metrics. - Rendered full-width there rather than inside the narrow work column. */ - const statusStrip = ( -blocked ? ( -
-
- ) : stalled ? ( -
-
- ) : stage?.kind === 'customer' && stage.doing ? ( - /* Not an agent working, and not a task of yours either — the lead - is with someone outside the business. Without this the screen - went blank at exactly the stage where an operator is most likely - to wonder whether something has broken. */ -
-
- ) : stage?.kind === 'auto' ? ( -
-
- ) : null - ) // Only what THIS user may run. The workflow refuses the rest server-side // anyway; showing them a row of buttons that all 403 reads as a broken app // rather than as a control. @@ -454,6 +379,83 @@ blocked ? ( // the way out rather than going on promising two minutes. const stillFor = row.updated_at ? now - Date.parse(row.updated_at) : 0 const stalled = !blocked && stage?.kind === 'auto' && stillFor > STALL_AFTER_MS + + /* WHAT IS HAPPENING NOW, lifted above the numbers. An operator's first + question about a lead is "what is going on / what do I do", not "what is + the premium" — so the status strip (an alert when blocked or stalled, the + live state otherwise) sits directly under the header, before the metrics. + Rendered full-width there rather than inside the narrow work column. */ + const statusStrip = ( +blocked ? ( +
+
+ ) : stalled ? ( +
+
+ ) : stage?.kind === 'customer' && stage.doing ? ( + /* Not an agent working, and not a task of yours either — the lead + is with someone outside the business. Without this the screen + went blank at exactly the stage where an operator is most likely + to wonder whether something has broken. */ +
+
+ ) : stage?.kind === 'auto' ? ( +
+
+ ) : null + ) + ? { mins: Math.round(stillFor / 60000), nudge: nudgeFor(stage, row) } : null