fix(web): ignore a missing documentElement when marking the home screen revealed
Independent Staging Quality Gate / validate (push) Failing after 10m8s
Independent Staging Quality Gate / publish (push) Skipped

This commit is contained in:
jesse-ux
2026-09-22 13:42:36 +08:00
parent c6d421edba
commit f77a1b5a33
4 changed files with 28 additions and 2 deletions
@@ -82,7 +82,9 @@ export function useHomeShellRegistration(params: HomeShellRegistrationParams) {
useEffect(() => {
// The inline dead-screen script stands down only after the app has revealed.
if (!hydrated || typeof document === "undefined") return;
// Shell tests mount this hook without a documentElement; missing it must not
// throw, or the registration effect never gets to run.
if (!hydrated || typeof document === "undefined" || !document.documentElement) return;
document.documentElement.dataset.hydrated = "1";
}, [hydrated]);
@@ -192,6 +192,7 @@ test("fallback script is classic ES5 and waits past the bootstrap budgets", () =
assert.match(layout, /firstPaintFallbackBootScript\(\)/);
assert.doesNotMatch(layout, /firstPaintFallbackBootScript\(\)[\s\S]{0,80}type\s*=\s*["']module["']/);
assert.match(hook, /!document\.documentElement\) return/);
assert.match(hook, /document\.documentElement\.dataset\.hydrated = "1"/);
assert.equal(page.includes("dataset.hydrated"), false);
assert.match(page, /连接云端服务超时/);