fix(ui): stop a deploy from silently breaking open tabs, and delete the dead service worker

Four frontend defects from the issue list, all variations on "code ran before
the thing it depends on existed".

Stale chunks (13 issues, recurring). A production build empties outDir, and
hashedAssetMiddleware deliberately 404s a hash the replica does not have, so a
tab left open across a deploy 404s its next lazy import and silently loses
whatever that chunk powered. Catch vite:preloadError and reload once. The guard
is a timestamp rather than a flag: we deploy several times a day, and a flag
would leave a long-lived tab permanently unguarded after its first reload.

debounce is not defined (critical). window.debounce is published only by the
lazily-imported widgets chunk, but Dashboards' initializeGrids calls it on
DOMContentLoaded. The throw landed mid-setup, so grid-stack-initialized,
setAnimation and window.gridStackInstance were all skipped. Define debounce
locally and drop the cross-module timing dependency.

Service worker (9 issues). static/public/sw.js was a workbox bundle regenerated
only by a manual make target, so its precache manifest pinned chunk URLs from
2026-08-06. 20 of its 104 entries no longer existed, and workbox fails the whole
install if any entry 404s — it had not installed successfully in three weeks and
could never self-correct. Precaching content-hashed chunks is also the wrong
strategy: they are immutable by hash already. Delete it, and unregister on
clients that still hold a live one.

'widgetJSON' is null / '#trace_expanded_view' is null. Both are hyperscript
reaching for something only one page defines. Guard them the way their sibling
handlers already do.

Adds a test that parses every [__|…|] quasiquote in src/ with the vendored
_hyperscript. GHC treats these as opaque strings, so a parse error ships and
only surfaces in the browser. It immediately found two live ones: `halt the
bubbling` (invalid; the tablist handler never ran) and the unquoted
`send tab-visible`, where the hyphen parses as subtraction.
This commit is contained in:
Anthony Alaribe 2026-08-31 22:51:27 +02:00
commit 15e0e08724
14 changed files with 242 additions and 58 deletions