Fix DOT intake: retry init until wizard found + null-safe PWIntake
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7fe3311921
commit
d55384975e
1 changed files with 6 additions and 5 deletions
|
|
@ -266,7 +266,7 @@
|
|||
|
||||
function showRelevantSections() {
|
||||
const PW = (window as any).PWIntake;
|
||||
const state = PW.get();
|
||||
const state = PW?.get?.() || {};
|
||||
// Get service slug from wizard element or state
|
||||
const wizardEl = document.querySelector(".pw-wizard[data-service]");
|
||||
const pageSlug = wizardEl?.getAttribute("data-service") || "";
|
||||
|
|
@ -300,12 +300,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Show sections on DOM ready and on step-shown
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", showRelevantSections);
|
||||
} else {
|
||||
// Show sections — retry until wizard element is found
|
||||
function initSections() {
|
||||
const wizardEl = document.querySelector(".pw-wizard[data-service]");
|
||||
if (!wizardEl) { setTimeout(initSections, 100); return; }
|
||||
showRelevantSections();
|
||||
}
|
||||
initSections();
|
||||
window.addEventListener("pw:step-shown", (evt: any) => {
|
||||
if (evt.detail.step !== "dot-intake") return;
|
||||
showRelevantSections();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue