From 82a4a60e38a34219c36d270c7ccc79a69ef87f9c Mon Sep 17 00:00:00 2001 From: MattNotarangelo Date: Tue, 30 Jun 2026 15:43:41 -0700 Subject: [PATCH] fix(viewer): apply saved theme before first paint to stop dark-mode flash A light-mode reload briefly painted the default dark theme because the theme was only applied by the deferred app bundle, after first paint. Apply the saved theme to from a tiny same-origin script loaded blocking in , before the bundle. No CSP change needed: script-src 'self' already covers it. Co-Authored-By: Claude Opus 4.8 (1M context) --- index.html | 3 +++ public/theme-init.js | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 public/theme-init.js diff --git a/index.html b/index.html index a98ae0d..6eac48d 100644 --- a/index.html +++ b/index.html @@ -12,6 +12,9 @@ http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' https://static.cloudflareinsights.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self' https://cloudflareinsights.com; worker-src 'self' blob:; object-src 'none'; base-uri 'self'; form-action 'none'" /> + + Cave Survey Viewer