Changing the shape of apps. adding better error boundries at stateful components. start fontViewer

This commit is contained in:
Dustin Swan 2026-02-22 17:00:07 -07:00
parent d58c39a1ac
commit cc33b9a015
No known key found for this signature in database
GPG key ID: 30D46587E2100467
5 changed files with 197 additions and 117 deletions

View file

@ -97,7 +97,17 @@ export function runAppCompiled(canvas: HTMLCanvasElement, store: any) {
}
const emit = (event: any) => ({ _tag: 'ComponentEvent', _0: fullKey, _1: event });
const viewResult = instance.view(instance.state)(emit);
let viewResult;
try {
viewResult = instance.view(instance.state)(emit);
} catch (e: any) {
viewResult = {
kind: 'stack', children: [
{ kind: 'rect', w: 9999, h: 60, color: '#400' },
{ kind: 'text', content: `Error: ${e.message}`, x: 10, y: 30, color: '#f88' }
]
};
}
const viewUI = {
kind: 'clickable',