codeburn/app/renderer/main.tsx
iamtoruk e4bbcaaba7 fix(app): zero background work when hidden; currency applies instantly
Energy (field report: ~3x Chrome drain):
- polls skip entirely while the window is hidden/minimized, with one
  catch-up refresh on return when data is stale; visible-but-unfocused
  keeps polling (second-monitor case)
- all looping animations pause under html.page-hidden (the sidebar
  flame flicker was a perpetual compositor drain)
- default cadence 60s; an explicit stored choice is always honored

Currency (field report: set USD, still saw EUR):
- memo-served payloads re-applied their embedded stale currency; config
  mutations now purge the renderer memo and force-refresh, and a
  switching payload can never overwrite the applied currency
- USD default verified end to end

Measured: hidden window = 0 new CLI spawns over 5 cadences (was: full
polling forever). App 340/340, build + package green.
2026-07-16 18:41:28 -07:00

24 lines
777 B
TypeScript

import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { App } from './App'
import { installPageHiddenClass } from './lib/pageVisibility'
import './styles/indigo.css'
import './styles/plain.css'
const root = document.getElementById('root')
if (!root) throw new Error('#root not found')
// Pause looping CSS animations while the window is hidden/minimized (energy).
installPageHiddenClass()
// Tag the platform so CSS can adapt native chrome (macOS hiddenInset insets +
// drag regions); harmless when the bridge is absent (tests/jsdom).
document.documentElement.dataset.platform =
(window as unknown as { codeburn?: { platform?: string } }).codeburn?.platform ?? ''
createRoot(root).render(
<StrictMode>
<App />
</StrictMode>,
)