Uh oh!
There was an error while loading. Please reload this page.
docs(runner): §Add Custom Routes 改写为指向 Add Custom Schemas 的元数据路由说明 (#3618) - #3646
Merged
Merged
Conversation
…3618) `### Add Custom Routes` 让读者 "Edit src/App.tsx" 并给了一段 react-router 代码。 两处与实现相反: 1. `react-router-dom` 不在 `packages/runner/package.json` 的任何依赖里(dependencies 只有 @object-ui/{components,core,plugin-charts,plugin-kanban,react,types} + class-variance-authority / clsx / lucide-react / react / react-dom / tailwind-merge / tailwindcss-animate),全包 grep 'react-router' 零命中 —— 照抄直接 Failed to resolve import。 2. Runner 不是这个路由模型。App.tsx:83 用 useState 持有 currentPath,:120 history.pushState 导航,:127 监听 popstate,:137 把路径喂给 loader.loadPage(currentPath) —— 路由由元数据决定,没有路由表可改。 示例里的 Home / Dashboard / CustomPage 三个组件包里同样不存在。 处置取"保留标题 + 改写为正确说明"而非整节删除:与 #3538/#3633 删掉的 `## Environment Variables` / `### 2. Environment Configuration` 不同,那两处描述的 配置面在实现里**不存在**,删掉即无残留问题;而"加路由"是 Runner 真实支持的能力, 只是机制不同(加 JSON 文件),答案就在同页 40 行之下的 `### Add Custom Schemas`。 删掉标题会让按"routes"检索的读者一无所获,并可能重新自行推导出"改 App.tsx"的错误 直觉。本页已有同形态先例:`### Metadata — Supplied by You`(:59)同样是"短说明 + 指向权威小节"的路标节,两处 [Metadata Loading](#metadata-loading) 交叉引用(:63、 :87)也证明页内锚点是本页既有节奏。 `#add-custom-routes` 锚点全仓无任何引用(grep 零命中),故两种处置都不会断链; 保留标题额外保住了站外深链。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
The latest updates on your projects. Learn more about Vercel for GitHub. |
yinlianghui
marked this pull request as ready for review
August 7, 2026 16:58
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 7, 2026
akarma-synetal pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Aug 10, 2026
…ck-ai#3619) (objectstack-ai#3652) (objectstack-ai#3676) objectstack-ai#3619:§Features 的「All official plugins included」与同页 §Pre-installed Plugins 自相矛盾 —— runner 的 dependencies 里只有 plugin-kanban 与 plugin-charts 两个 plugin-*,而仓库里有 19 个 packages/plugin-*。措辞与 PR objectstack-ai#3644 在 README 侧落地的 口径对齐,不留开放集合暗示。 objectstack-ai#3652:三处把 src/main.tsx 指认为插件 import 所在地(§Adding Custom Plugins 第 2 步、 §Use Cases 代码注释、§Troubleshooting 排查步骤),但真实 main.tsx 共 18 行、零个 @object-ui/plugin-* import;side-effect import 在 App.tsx:13-15。Troubleshooting 那处危害最大 —— 排查步骤指向一个永远看不到 import 的文件,既不能证实也不能证伪, 线索到此断掉;改写为可执行的排查动作,并点明 main.tsx 看不到的原因。 §Adding Custom Plugins 的 npm link 建议按 pnpm workspace 实况改写:仅换掉 npm link 仍会留下一份跑不通的步骤 —— 缺 vite.config.ts 别名条目即复现 objectstack-ai#3575 的 HTTP 500。 补齐两个预装插件实际具备的四个接线点(package.json 的 workspace:* 依赖、App.tsx 注册 import、vite.config.ts 别名、index.css 的 @source),与 README(objectstack-ai#3644)一致。 无 changeset:站点文档单文件改动,同页前三次改动(objectstack-ai#3633/objectstack-ai#3646/objectstack-ai#3651)均无。 Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#3618
content/docs/utilities/runner.mdx的### Add Custom Routes让读者 "Editsrc/App.tsx",并给出一段 react-router 代码(BrowserRouter/Routes/Route三件套,路由到Home、Dashboard、CustomPage三个组件)。这一节与实现有两处相反。前提复核(独立于 issue 正文,对
origin/main切点fa3ba5bf1)issue 正文的三条断言逐条复核,全部成立:
react-router-dom不是 runner 的依赖。packages/runner/package.json的dependencies为@object-ui/{components,core,plugin-charts,plugin-kanban,react,types}+class-variance-authority/clsx/lucide-react/react/react-dom/tailwind-merge/tailwindcss-animate;devDependencies也没有。全包grep -rn 'react-router' packages/runner/零命中。照抄这段直接Failed to resolve import。packages/runner/src/App.tsx::83useState(window.location.pathname)持有currentPath,:120history.pushState导航,:127监听popstate,:137loader.loadPage(currentPath)。路由由元数据决定,没有路由表可改。packages/runner/src全部文件只有App.tsx/LayoutRenderer.tsx/main.tsx/lib/MetadataLoader.ts/lib/mockDataSource.ts加测试;Home/Dashboard/CustomPage无一存在(唯一命中是 App.tsx:194 的按钮文案 "Go Home")。补一条 issue 未提但对措辞有用的:
### Add Custom Schemas(:439,本 PR 后)已经把正确做法写对了 —— 「The file name is the route: this one is served at/my-page」,且LocalBundleLoader.loadPage()与NetworkLoader两条路径都是「路由 → 文件/请求」的映射,## Metadata Loading一节已完整覆盖。前后对照
修改前(:409-427,19 行):一句 "Edit
src/App.tsx:" + 一个 15 行 typescript 代码块,内容为react-router-dom的 import 与一张 JSX 路由表。修改后(6 行,无代码块):
净
6 insertions(+), 17 deletions(-),单文件。处置取舍:为什么保留标题改写,而不是整节删除
issue 与分诊都给了「删除 或 一行指向
### Add Custom Schemas」两个选项。取后者,理由三条:## Environment Variables、### 2. Environment Configuration)描述的配置面在实现里根本不存在 —— 读者的问题本身无解,删掉即无残留。而「怎么加一个路由」是 Runner 真实支持的能力,只是机制不同(加一个 JSON 文件),答案就在同页 40 行之下。此处是问题合法、答案是编造的,删标题等于把一个合法问题连同错误答案一起抹掉。App.tsx)。## Extending the Runner下若只剩 Components / Schemas 两节,按 "routes" 检索的读者一无所获,很可能自行重新推导出同一个「改 App.tsx」的错误直觉。一句显式的「没有路由表、不要改代码」是对该直觉的免疫。### Metadata — Supplied by You(:59)就是「短说明 + 指向权威小节」的路标节,本身不含代码;页内[Metadata Loading](#metadata-loading)交叉引用已用过两次(:63、:87),证明页内锚点在本页是成立且惯用的写法。⛔ 未做也不建议:把
react-router-dom真加进依赖让文档成真。分诊已裁定那是产品决定,不归 docs 卡。⛔ 未发明任何新 API:改写后的每个分句都对应上面复核过的 file:line。锚点
#add-custom-routes全仓grep -rn 'add-custom-routes'零命中(含content/、apps/、packages/、README),两种处置都不断链;保留标题额外保住了可能存在的站外深链。新引入的两个页内锚点目标均存在:### Metadata Loading(:91)、### Add Custom Schemas(:439)。验证(先预测后实测,三条全部命中)
grep -c 'react-router-dom' content/docs/utilities/runner.mdx归零10✅node scripts/check-doc-links.mjs前后皆绿Links are valid across 6 scan roots.exit 0node scripts/check-control-bytes.mjs绿OK (scanned 3661 tracked text file(s); skipped 85 binary)exit 0 ✅修改前的基线用
git diff存盘 +git checkout --还原后实测(未用git stash,遵 CLAUDE.md 共享栈禁令),随后git apply恢复。补充说明两点,避免误读为更强的证据:
check-doc-links.mjs对本 PR 是弱证据。 该脚本显式把#fragment剥离后再校验(脚本注释:解析锚点需要解析目标页,明确不在范围内),因此本 PR 新增的两个页内锚点它并不校验。上表的「前后皆绿」只说明没引入坏的外链/路由链(本 PR 也确实未新增任何外链)。锚点有效性是我按上面「锚点」一节手工核验的。grep -naP '[\x00-\x08\x0b\x0c\x0e-\x1f]' content/docs/utilities/runner.mdx零命中。未跑包级
pnpm test/pnpm typecheck:本 PR 是站点文档单文件改动,不触及任何packages/*源码或类型面,两者对该 diff 无信号(ci.yml/lint.yml亦把**/*.md列入paths-ignore)。changeset
不加,判断依据:
content/docs属@object-ui/site(apps/site/package.json),而.changeset/config.json的ignore为["@object-ui/example-*","@object-ui/site"]—— 该包不随固定版本组发布。同文件同类先例 #3633(d9a03fe9a)亦为 0 个 changeset 文件。越界发现(只报不改)
通读全页时发现同页
### vite.config.ts(:161)展示的配置在实现里不存在 —— 真实packages/runner/vite.config.ts没有server块(故port: 5173是 Vite 默认值而非配置项,open: true纯属虚构),而真正关键的resolve.alias传递闭包表(#3575 的硬不变量)与build.modulePreload: false被完全隐去。已按 Prime Directive #10 另立 issue #3643(unassigned),未在本 PR 顺手修改。 去重已做:#3593 是真实 vite.config.ts 里data-objectql别名的代码侧问题,#3619 / #3635 / #3632 分别是 Features 清单 / Error Boundaries 导入 / README 清单,均不覆盖本节。🤖 Generated with Claude Code
https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
Generated by Claude Code