mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-09 01:16:15 -08:00
Three first-paint fixes for cold app start. #1 — Inline splash in index.html Cold start used to show a blank Material-grey background until the ~1.5MB preloaded chunk + 300KB styles.css downloaded and Angular bootstrapped. On slow disks/networks that's 1-3+ s of "is the app frozen?" before any pixel of UI appears. Add a self-contained splash (inline CSS, no extra HTTP, no assets) — "IPTVnator" wordmark + a CSS spinner — that paints immediately from the parsed HTML. Removed in main.ts after bootstrapApplication() resolves, gated on requestAnimationFrame so the swap happens after AppComponent's first paint (no flash of empty background between splash removal and the real UI). Respects prefers-reduced-motion (spinner stops, opacity dims). #3 — Drop legacy `global = window` polyfill The inline <script> in <head> ("if (global === undefined) var global = window") was a workaround for an older library expecting Node's `global`. Verified nothing in the current bundle reads window.global (the only matches are TypeScript `declare global { ... }` blocks and unrelated route paths). Removes one render-blocking inline <script> parse from the critical path. #5 — Synchronous language hint Settings live in IndexedDB (via @ngx-pwa/local-storage), which the TranslateModule cannot read synchronously at bootstrap. So the first render historically used English regardless of the user's preference, then re-rendered every TranslatePipe in the tree once initSettings() finished — visible flash for non-English users. Mirror the active language to localStorage in initSettings() once the IDB-backed settings resolve. Add getInitialLanguage() in app.config.ts that reads that key synchronously before bootstrap and passes it to TranslateModule.forRoot({ defaultLanguage }). First-ever boot still falls back to English (no hint yet); every subsequent boot renders in the saved language from the very first frame. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Entire-Checkpoint: f957cd9849e0