Files
hermes-agent/apps/desktop/index.html
dokterdok b573af6a13 fix(desktop): show a reload notice when the renderer's boot fails
Since 3d8dafc729 the renderer loads the whole app through one dynamic
import, and in the production build every app stylesheet is a
dependency of it. When one of them, or the app chunk, fails to load once
(a dropped request), the import rejects, `void` discards the rejection
and React never mounts: the page stays blank with nothing to click.

The entry now logs the cause and, while #root is still empty, shows a
short notice with a Reload button. Transparent windows (the pet overlay,
the wake indicator) only log: they are click-through or too small for a
notice, which would only paint over the desktop. Their list moves into a
small module that the entry and main.tsx share. It never reloads on its own, as the
dashboard's chunk recovery settled for a failure on the same build
(#145357), and as native Desktop treats a failed page load.
2026-10-28 08:35:05 -07:00

51 lines
2.4 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content" />
<meta name="color-scheme" content="light dark" />
<meta name="theme-color" content="#0a0a0a" />
<link rel="icon" type="image/png" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="shortcut icon" href="/apple-touch-icon.png" />
<title>Hermes</title>
<script>
// Pre-paint the themed background before the app bundle loads. Without
// this, the first frame (which is what `ready-to-show` waits for) is the
// UA-default white page, and the real theme only lands once the whole
// module graph has executed — i.e. the "white flash" on every new
// window. applyTheme() in src/themes/context.tsx keeps these keys fresh.
//
// OPAQUE WINDOWS ONLY. The `?win=` kinds Electron creates with
// `transparent: true` already have a clear canvas, and pre-painting a
// theme colour there does not prevent a flash, it IS the flash: an
// opaque rectangle standing until that window's module graph executes.
// The list is TRANSPARENT_WINDOWS in src/lib/transparent-windows.ts — keep the two in step.
// `secondary` (a session window) and `browser` are opaque and DO want the
// pre-paint.
try {
const win = new URLSearchParams(window.location.search).get('win')
if (!win || ['hud', 'overlay', 'quick', 'wake'].indexOf(win) === -1) {
let bg = localStorage.getItem('hermes-boot-background')
let scheme = localStorage.getItem('hermes-boot-color-scheme')
if (!bg) {
const dark = window.matchMedia('(prefers-color-scheme: dark)').matches
bg = dark ? '#111111' : '#f7f7f7'
scheme = dark ? 'dark' : 'light'
}
document.documentElement.style.backgroundColor = bg
if (scheme === 'dark' || scheme === 'light') {
document.documentElement.style.colorScheme = scheme
}
}
} catch {
// localStorage unavailable — keep UA defaults.
}
</script>
</head>
<body>
<div id="root" class="scrollbar-dt"></div>
<script type="module" src="/src/entry.ts"></script>
</body>
</html>