// --------------------------------------------------------------------------- // shell / ErrorBoundary.tsx — WAVE 30, owner item 2 (ruling R5). // // ⛔ WHY THIS FILE EXISTS, AND THE MEASUREMENT BEHIND IT. Until today, // `ErrorBoundary|componentDidCatch|getDerivedStateFromError` had ZERO hits in the // whole of `web/src`. React's contract when a render throws and nothing catches it // is to unmount the ENTIRE tree — so one unguarded property access anywhere in the // product produced a blank white page. That is exactly what a user calls "it // crashes", and it is why owner item 2 arrived as a report with no diagnosis: there // was nothing left on screen to diagnose. // // A boundary is therefore not a workaround for the hide-fields panel. It is the // difference between "one surface failed and said so" and "the product vanished". // // ⚠ WHAT NO GATE IN THIS REPO CAN PROVE, measured 2026-08-12 rather than assumed — // written here so nobody reads the gate as stronger than it is: // · there is NO DOM. `jsdom`, `happy-dom`, `linkedom`, `domino` and // `react-test-renderer` are all absent from `web/node_modules` (160 packages), // and there is no vitest. So the React RECONCILER cannot be run under node. // · React 18.3.1's server renderers do NOT invoke error boundaries. Both // `renderToString` and `renderToStaticMarkup` were fed one throwing child under // a boundary declaring `getDerivedStateFromError`; both PROPAGATED the throw and // `componentDidCatch` never fired. // ⇒ the fallback is a SEPARATE exported component precisely so it can be rendered // for real, and the class's protocol is driven by hand in `verify_grid_ux.py` // (throw → catch → `getDerivedStateFromError` → `render()`), which is React's own // documented sequence. The reconciler's guarantee is React's, not ours; what IS // ours — that every surface is actually wrapped — is a source scan, and that is // the check with teeth ([[reachable-is-not-the-same-as-built]]: a boundary that // exists and wraps nothing is this repo's sixth whole-correct-unreachable feature). // --------------------------------------------------------------------------- import { Component } from "react"; import type { ErrorInfo, ReactNode } from "react"; import "./errorBoundary.css"; export interface FailurePanelProps { /** The surface that failed, named the way the user got to it ("Odoo orders", * "Automation", "Loopable"). A panel that will not say WHAT broke sends the * reader back to us with the same sentence item 2 arrived with. */ surface: string; /** The thrown message. Shown, not hidden: a user who can paste one line saves a * scouting session. ⚠ It is the message ONLY — never a stack, and never a value * from a row, because this panel is on screen wherever the failure happened. */ message?: string; onReload: () => void; } /** * The contained failure card. * * It borrows `.shell-placeholder` and `.shell-retry` on purpose — the shell already * has two failure panels (the data-error card and the nav-failed card) and a third * visual language for the same idea would read as a different kind of problem. The * only new paint is the tone strip in `errorBoundary.css`, which is what separates * "this did not load" from "this broke". * * Exported as its own component so it can be rendered for real under node; see the * measurement in this file's header for why the class cannot be. */ export function FailurePanel({ surface, message, onReload }: FailurePanelProps) { return (
Something here failed while drawing. The rest of the app still works — pick another database from the sidebar, or reload to try this one again.
{message ?{message}
: null}