From ab10d93f9d769eaea41baf503a14b60d6d18c298 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Aug 2026 14:50:02 +0000 Subject: [PATCH 1/2] =?UTF-8?q?fix(app-shell):=20=E7=A9=BA=E6=80=81?= =?UTF-8?q?=E3=80=8CCreate=20Your=20First=20App=E3=80=8DCTA=20=E6=8C=87?= =?UTF-8?q?=E5=90=91=E5=B7=B2=E5=A3=B0=E6=98=8E=E7=9A=84=20app=20=E5=86=85?= =?UTF-8?q?=20create-app=20=E8=B7=AF=E7=94=B1=20(#3573)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 零应用部署的第一屏上,唯一指向「建应用」的 CTA 调用 navigate('/create-app') —— 带前导斜杠的绝对路径,从宿主的根路由树解析。根路由树没有声明 /create-app,于是落到 末尾的 兜底,被 replace 回落地页 `/`:按钮看起来毫无反应。 真正声明 create-app 的是 AppContent 自己,位于 /apps/:appName/* 子树内(无 activeApp 分支与有 app 的路由表各一处)。改为构造 app 作用域的 /apps//create-app —— ADR-0048 的规范应用 URL,也正是 AppSidebar 的 add-app 入口已经在用的同一目标。 实测记录(新增路由测试逐条钉住): - 空态的真实 URL 家族是 /apps/setup 及其子路径。空态前置条件要求 !activeApp 且 非 create-app/system/metadata 三条伪路由;要绕过 requestedAppMissing 又必须 isSpecialRoute,相减后只剩 isSetupRoute。零应用用户从 `/` 会被 RootLandingRedirect 送到 /home,AppContent 根本不挂载 —— 空态只在子树内出现。 - 因此「改成相对跳转 navigate('create-app')」不成立:装机的 react-router 7 里 getResolveToMatches 用 LEAF match 的完整 pathname(含 splat)作为相对解析基 (v6 的 v7_relativeSplatPath 开关,v7 已固化)。它只在最浅的 /apps/setup 正确, 从 /apps/setup/ 会拼出 /apps/setup//create-app —— 匹配不到 任何路由,渲染成白屏,比原来的弹回更难诊断。 反向验证:两条 CTA 测试在未改的源码上先跑红(dump 里 pathname 为 `/`、 root-landing 已渲染),改后 6/6 全绿。旁边的 go-to-settings-btn 未触及, 其绝对 /apps/setup 目标另有一条测试守住。 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt --- .../no-apps-create-first-app-cta-3573.md | 26 ++ packages/app-shell/src/console/AppContent.tsx | 19 +- .../__tests__/AppContent.noAppsCta.test.tsx | 222 ++++++++++++++++++ 3 files changed, 266 insertions(+), 1 deletion(-) create mode 100644 .changeset/no-apps-create-first-app-cta-3573.md create mode 100644 packages/app-shell/src/console/__tests__/AppContent.noAppsCta.test.tsx diff --git a/.changeset/no-apps-create-first-app-cta-3573.md b/.changeset/no-apps-create-first-app-cta-3573.md new file mode 100644 index 0000000000..6ae29a41cf --- /dev/null +++ b/.changeset/no-apps-create-first-app-cta-3573.md @@ -0,0 +1,26 @@ +--- +'@object-ui/app-shell': patch +--- + +The no-apps empty state's "Create Your First App" CTA now opens the app-creation +flow instead of silently bouncing the user back to the landing page. It called +`navigate('/create-app')` — an ABSOLUTE path, so it resolved against the HOST's +root route tree, which declares no `/create-app`; the reference host's trailing +`` therefore replaced it with `/`. The `create-app` route is +declared by `AppContent` itself, inside the `/apps/:appName/*` subtree (both the +no-active-app branch and the with-app router), so the CTA now builds the +app-scoped `/apps//create-app` — the platform's canonical app URL +(ADR-0048) and the same target the sidebar's add-app entry already links to. On +a fresh zero-app deployment this was the first screen's only route into app +creation, and it read as a button that does nothing (#3573). + +A plain relative `navigate('create-app')` is deliberately NOT the fix, and the +new routing test pins why: under the installed react-router 7, +`getResolveToMatches` resolves a relative target against the LEAF match's full +`pathname` with the splat INCLUDED (in v6 this was the `v7_relativeSplatPath` +future flag; v7 hardcodes it). The empty state renders across a whole URL family +— `/apps/setup` and any deeper `/apps/setup/` — so the relative form is +right only at the shallowest of them and builds +`/apps/setup//create-app` elsewhere, which matches no route and renders +a blank screen instead of the bounce. The sibling "System Settings" CTA is +unchanged. diff --git a/packages/app-shell/src/console/AppContent.tsx b/packages/app-shell/src/console/AppContent.tsx index 9b4973690a..92333202ed 100644 --- a/packages/app-shell/src/console/AppContent.tsx +++ b/packages/app-shell/src/console/AppContent.tsx @@ -573,7 +573,24 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps = {t('empty.noAppsConfiguredDescription')}
-