From 38138c1cfafc8a68f50a3d2b2b024e6d2828ec13 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 8 Aug 2026 09:07:00 +0000 Subject: [PATCH] =?UTF-8?q?docs(runner):=20Error=20Boundaries=20=E4=B8=80?= =?UTF-8?q?=E6=9D=A1=E6=94=B9=E4=B8=BA=E5=8F=AF=E8=BE=BE=E7=9A=84=20Schema?= =?UTF-8?q?ErrorBoundary=20(#3635)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原示例从 @object-ui/components 导入 ErrorBoundary,而该包无此导出; runner 也不依赖真身所在的 app-shell。但 runner 直接依赖的 @object-ui/react 经 src/index.ts:9 的 `export * from './SchemaRenderer'` 已公开导出 SchemaErrorBoundary,故零 API 成本即可就地改正。 同时按裁决讲清内建/外层边界分工:SchemaRenderer 内建的按组件边界在 SchemaRenderer.tsx:447 才构造,此前的表达式求值与注册表查找路径的 抛出会外逃,外层边界并非纯冗余。 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt --- content/docs/utilities/runner.mdx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/content/docs/utilities/runner.mdx b/content/docs/utilities/runner.mdx index e2c8ff8a24..f4393512ab 100644 --- a/content/docs/utilities/runner.mdx +++ b/content/docs/utilities/runner.mdx @@ -523,16 +523,28 @@ src/app-data/ ### 2. Error Boundaries -Wrap components in error boundaries: +`SchemaRenderer` already wraps **each rendered component** in a `SchemaErrorBoundary` of +its own, so a single widget that throws degrades to an inline "failed to render" notice +with a Retry button instead of blanking the page — see +[Architecture Overview](/docs/guide/architecture-overview). + +That inner boundary only exists once the component has been resolved. Everything +`SchemaRenderer` does before that point — evaluating `visibleOn`, `disabled` and the +other dynamic expressions, then looking the component type up in the registry — runs +outside it, so a throw there propagates past the inner boundary. Wrap `SchemaRenderer` +itself to catch that class of failure: ```typescript -import { ErrorBoundary } from '@object-ui/components' +import { SchemaErrorBoundary } from '@object-ui/react' - + - + ``` +Two optional props tune it: `componentType` names the component in the fallback text, and +`resetKey` clears the error and remounts the subtree whenever its value changes. + ## Next Steps - **[CLI](/docs/utilities/cli)** - Use CLI for rapid development