From b5aef58108e90a7b3fa146b54db5a0fd08eaf374 Mon Sep 17 00:00:00 2001 From: Stephan Strittmatter Date: Mon, 17 Aug 2026 22:03:30 +0200 Subject: [PATCH 01/18] fix(web): eliminate white screen on PWA startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dashboard showed a blank white page for seconds on open because the single-threaded ESP32 web server serializes every request and the page blocked first paint on two render-blocking resources: - style.css (16 KB) was render-blocking in — nothing painted until it arrived, and the dark theme (and thus any visible content) only exists in CSS. - app.js (55 KB) was parser-blocking at the end of — HTML parsing halted until it downloaded and executed. - The service worker used network-first, so even repeat visits with a warm cache waited for the network round-trip to the device. Changes: - sw.js: switch to stale-while-revalidate. Repeat visits render instantly from cache while assets refresh in the background (with cache: 'no-store' so freshly uploaded assets are picked up). API calls stay network-only. Cache bumped to pool-ctrl-v2. - index.html: inline critical first-paint styles (dark background, base text) and load /style.css asynchronously via the media=print onload pattern, so the page paints themed immediately instead of white. app.js now loads with defer, unblocking HTML parsing. - WebPortal.cpp: add Cache-Control headers — no-cache for the entry page and sw.js, public max-age=3600 for the static assets — so the browser HTTP cache backs up the service worker. --- data/web/index.html | 22 ++++++++++++-- data/web/sw.js | 73 +++++++++++++++++++++++++++------------------ src/WebPortal.cpp | 10 +++++++ 3 files changed, 73 insertions(+), 32 deletions(-) diff --git a/data/web/index.html b/data/web/index.html index 57eec0a7..f6b023d8 100644 --- a/data/web/index.html +++ b/data/web/index.html @@ -19,8 +19,24 @@ - - + + + + + +

Pool Controller

@@ -614,7 +630,7 @@

ℹ️ About

- +