Repository navigation
Commit 6d8372a
fix(console): a missing /forms/NAME renders the shared localized not-found state (#27739)
domain:ui#4 · os-bill · session_01Utp6CbDAucNyQ4UtzCJKyh
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgDFH4S5pR1C8YvYCWWsZfXx)_
Fixes #27446
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:控制台 `/forms/NAME` 打开一个不存在的表单时,不再显示英文原文 "Form metadata not found:
view/NAME",改为显示控制台通用的「页面不存在」空状态(按会话语言显示,带「返回」按钮)。
- 为什么改:中文等非英文会话里这里漏出一句未翻译的英文报错,和控制台其它「找不到」页面不一致。
- 风险与回滚:只动 `FormPage.tsx` 的内部表单加载与错误渲染;仅 404 走新状态,其它加载失败照旧显示错误横幅。回滚即
revert 本 PR。
- 先看:`ui/apps/console/src/components/FormPage.tsx` 中 `FormNotFoundError`
与 `if (notFound && !loaded)` 两处;再看测试 `FormPage.notFound-27446.test.tsx`。
- 两分钟验证:`pnpm --dir ui exec vitest run
apps/console/src/components/FormPage.notFound-27446.test.tsx`,预期 3
个用例全绿(zh 显示「页面不存在」且页面无英文)。
- 需要你做的:无,席位落地。
## What changes
- `loadInternalForm` threw `Form metadata not found: view/NAME` for
every non-OK `/meta/view/NAME` read, and `FormPage` rendered that string
verbatim in its error banner, in every session language.
- A 404 from that read now throws a module-private `FormNotFoundError`.
The page keeps it in its own `notFound` flag (not in the `error`
string), and draws the console's shared not-found state: the `Empty` /
`EmptyTitle` / `EmptyDescription` layout of the catch-all
`RouteNotFound` in app-shell's `AppContent`, with its pack keys
`console.notFound.title`, `console.notFound.description` and
`console.notFound.back` (Go back, `navigate(-1)`). The metadata route
answers 404 both for a view that does not exist and for one the caller
may not read, so the page says the one thing both mean.
- Every other non-OK read keeps the error banner. Its text is now `Could
not load form metadata (STATUS): view/NAME`, because after the split the
old wording would claim "not found" for a 403 or a 500.
- No `@object-ui/i18n` key is added and no pack value changes
(`Clause-②: no`). All ten packs already carry `console.notFound.*`.
## Tests
- New `ui/apps/console/src/components/FormPage.notFound-27446.test.tsx`,
at the real `/forms/:name` route with no provider wrapped around it:
- zh: the state shows `页面不存在`, the zh description and a `返回` button, and
the page body holds no Latin word;
- en: `Page not found` and `Go back`, and no `Form metadata not found`;
- CONTROL: a 500 keeps the error banner and draws no not-found state.
- Ablation: with `FormPage.tsx` restored to the merge base, all 3 cases
fail (zh and en find no not-found state; CONTROL finds no `Could not
load form metadata (500)` text). Restored from `HEAD`, the file's hash
matched the HEAD blob.
<details><summary>Local runs (head 722dca5)</summary>
- `pnpm --dir ui exec vitest run apps/console/src/components/FormPage`
(all `FormPage*` suites): Test Files 39 passed (39), Tests 366 passed
(366).
- `pnpm --filter @object-ui/console run type-check`: exit 0 (the console
tsconfig includes `src`, so the new test is compiled).
- `pnpm --dir ui exec vitest run scripts/`: Test Files 169 passed, 2
skipped (171).
- `pnpm check:new-line-citations` (ui): 0 new citations.
- `node scripts/check-sdui-manifest.mjs` and the rest of the
`dispatch-gates --commands` list: exit 0, reconciled with `--ran`.
- Before pushing, `ui/` was grepped for `Form metadata not found`: the
only hit is the message `FormNotFoundError` keeps for logging. No test
pinned the old text.
</details>
## Acceptance notes
- Read only, not reproduced and not filed: the public `/f/:slug` loader
(`loadPublicForm`) also builds an English `Failed to load form (STATUS):
...` string that the same banner renders. It is the anonymous route and
is left unchanged here.
- The other English throws in `loadInternalForm` (a form view with no
`object` target, a record link naming another object) still render
verbatim. They are author or link faults, not "no such form", and are
out of this card's scope.
## Verification
In a zh-CN session, open `/_console/forms/no_such_form`: the page shows
`页面不存在` / `你访问的链接与该应用中的任何视图都不匹配。` and a `返回` button, with no English
text.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CbDAucNyQ4UtzCJKyh)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 34dc09b commit 6d8372a
3 files changed
Lines changed: 164 additions & 3 deletions
File tree
- .changeset
- ui/apps/console/src/components
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
152 | 162 | | |
153 | 163 | | |
154 | 164 | | |
| |||
1709 | 1719 | | |
1710 | 1720 | | |
1711 | 1721 | | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
1712 | 1740 | | |
1713 | 1741 | | |
1714 | 1742 | | |
| |||
1733 | 1761 | | |
1734 | 1762 | | |
1735 | 1763 | | |
| 1764 | + | |
1736 | 1765 | | |
1737 | | - | |
| 1766 | + | |
1738 | 1767 | | |
1739 | 1768 | | |
1740 | 1769 | | |
| |||
2336 | 2365 | | |
2337 | 2366 | | |
2338 | 2367 | | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
2339 | 2374 | | |
2340 | 2375 | | |
2341 | 2376 | | |
| |||
2421 | 2456 | | |
2422 | 2457 | | |
2423 | 2458 | | |
| 2459 | + | |
2424 | 2460 | | |
2425 | 2461 | | |
2426 | 2462 | | |
| |||
2446 | 2482 | | |
2447 | 2483 | | |
2448 | 2484 | | |
2449 | | - | |
| 2485 | + | |
| 2486 | + | |
2450 | 2487 | | |
2451 | 2488 | | |
2452 | 2489 | | |
| |||
2818 | 2855 | | |
2819 | 2856 | | |
2820 | 2857 | | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
2821 | 2876 | | |
2822 | 2877 | | |
2823 | 2878 | | |
| |||
0 commit comments