Catches rendering errors in Preact components and persists diagnostics.
// Source: https://github.com/im4codes/imcodes | License: MIT | Copyright 2026 IM.codes
// Provided via justclaw.it.com; keep this notice with the code.
import { Component } from 'preact';
import type { ComponentChildren } from 'preact';
import i18next from 'i18next';
import { dispatchAppUpdateRequired, getLoadedWebBuildId, isChunkLoadFailure } from '../app-update.js';
interface Props {
fallback?: ComponentChildren;
children: ComponentChildren;
}
interface State {
error: Error | null;
}
/**
* localStorage ring of recent boundary crashes. The chat-area "组件错误" had
* been recurring for months and was undiagnosable because the boundary
* swallowed the error: nothing surfaced it and nothing persisted it. Keep the
* last few crashes (message + stack head + component stack head + bui
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key