fix(web): ignore a missing documentElement when marking the home screen revealed
This commit is contained in:
@@ -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, /连接云端服务超时/);
|
||||
|
||||
Reference in New Issue
Block a user