fix(home): early boot reads load as an async data: script so stylesheets no longer hold them back (BUG-1127)
An inline classic script after the stylesheets waited for them to download; on staging the reads left at 2.4-3.1 s. Measurement script gains --css-delay and --ua iphone. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6e2f0af5a2
commit
c2265dabb2
@@ -78,6 +78,18 @@ export function bootEarlyReadsScript(): string {
|
||||
})();`;
|
||||
}
|
||||
|
||||
/**
|
||||
* The script as an async data: URL (BUG-1127 fix, 2026-10-01). An inline
|
||||
* classic script placed after the page's stylesheets waits until they have
|
||||
* downloaded (script-blocking stylesheets), which on staging held the early
|
||||
* reads back 2.4-3.1 s. An `async` external classic script is not blocked by
|
||||
* stylesheets, and a data: URL costs no round trip. Plain ASCII base64, so
|
||||
* the attribute needs no escaping.
|
||||
*/
|
||||
export function bootEarlyReadsScriptSrc(): string {
|
||||
return `data:text/javascript;base64,${Buffer.from(bootEarlyReadsScript(), "utf8").toString("base64")}`;
|
||||
}
|
||||
|
||||
function bootReads(): BootReads | null {
|
||||
if (typeof window === "undefined") return null;
|
||||
const reads = (window as unknown as Record<string, BootReads | undefined>)[BOOT_READS_GLOBAL];
|
||||
|
||||
Reference in New Issue
Block a user