| 5 | const root = document.getElementById('root') |
| 6 | |
| 7 | function renderBootError(message: string): void { |
| 8 | if (!root) return |
| 9 | root.replaceChildren() |
| 10 | const pre = document.createElement('pre') |
| 11 | pre.style.padding = '24px' |
| 12 | pre.style.color = '#b42318' |
| 13 | pre.style.background = '#fff7f7' |
| 14 | pre.style.font = '14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace' |
| 15 | pre.style.whiteSpace = 'pre-wrap' |
| 16 | pre.textContent = message |
| 17 | root.appendChild(pre) |
| 18 | } |
| 19 | |
| 20 | // Once the app has mounted, a stray async error must NOT blow away the whole |
| 21 | // UI — `renderBootError` wipes #root, so reserve it for failures that happen |