From dcdc6df8791d3ae817d7ca3b8b243037d61a1b5b Mon Sep 17 00:00:00 2001 From: justin Date: Wed, 29 Apr 2026 01:13:06 -0500 Subject: [PATCH] Fix CategoryStep crashing non-499-A intake pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CategoryStep script runs on ALL pages using the Wizard component. It tried to find #pw-wizard (its inner quiz div) and called querySelectorAll on it — null on CPNI/RMD/etc pages, crashing the entire script bundle. This prevented FRN auto-fill, officer suggestions, and all other intake functionality. Guard: if #pw-wizard doesn't exist, skip all CategoryStep logic. Co-Authored-By: Claude Opus 4.6 (1M context) --- site/src/components/intake/steps/CategoryStep.astro | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/site/src/components/intake/steps/CategoryStep.astro b/site/src/components/intake/steps/CategoryStep.astro index 0d5151c..591b2be 100644 --- a/site/src/components/intake/steps/CategoryStep.astro +++ b/site/src/components/intake/steps/CategoryStep.astro @@ -173,8 +173,13 @@ import { LINE_105_CATALOG, LINE_105_BY_ID } from "../../../lib/line_105_catalog" import { LINE_105_CATALOG, LINE_105_BY_ID } from "../../../lib/line_105_catalog"; const err = document.getElementById("pw-cat-err") as HTMLDivElement; - const wizard = document.getElementById("pw-wizard") as HTMLDivElement; - const result = document.getElementById("pw-result") as HTMLDivElement; + const wizard = document.getElementById("pw-wizard") as HTMLDivElement | null; + const result = document.getElementById("pw-result") as HTMLDivElement | null; + + // Guard: CategoryStep only runs on pages that have the category wizard + if (!wizard) { + // Not a 499-A page — skip all CategoryStep logic + } else { // Wizard state const answers: Record = {}; @@ -469,4 +474,6 @@ import { LINE_105_CATALOG, LINE_105_BY_ID } from "../../../lib/line_105_catalog" } err.hidden = true; }); + + } // end of: if (!wizard) {} else {