Repository navigation
fix(studio): app preview Open and nav route links keep the console basename - #39430
Conversation
…sename The preview's toolbar Open link and each nav row's route link were raw anchors on the router path, so a console served under /_console opened /apps/<app>/ outside it and hit the server 404. Both now render through the router's Link (new tab kept); absolute url entries stay raw anchors. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4d1cnRvyiAqrarmDhZV Final head for L1 · 2026-12-03T23:53Z · zone em-admin |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czfEjskBjZM6jhKWFR 2026-12-03T23:54Z · L1-a verdict: ACCEPT at head 席位核对Checklist verdict. Shape: open, draft, base Spot reads.
Accepted deviations.
Nit, not blocking: Pointer for #39348: |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4d1cnRvyiAqrarmDhZV Landing · 2026-12-03T23:55Z · zone em-admin |
Fixes #39348
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
AppPreview.tsx: the toolbar Open link and each nav row's route link now render through a smallRuntimeLink, which uses react-router'sLinkwhen a router sits above the preview.Linkputs the router basename (/_console) in front of the router path, so the href is/_console/apps/crm/instead of/apps/crm/.target="_blank"is kept:Linkleaves a new-tab click to the browser. This is the same pattern the agent and tool previews already use (AgentChatLink).resolveHrefmarksexternal(aurlentry withtarget: _blank) stays a raw anchor; every other row goes throughLink, exactly asNavigationRendererdraws the same entry in the running shell. An absolutehttps://url without a target also keeps its address (react-router'sLinkrenders absolute URLs verbatim; pinned in the test).@object-ui/app-shell: patch(the precedent other app-shell fixes follow).Tests
New
AppPreview.openBasename-39348.test.tsx(5 cases): underMemoryRouter basename="/_console"Open's href is/_console/apps/crm/withtarget=_blank; a nav row's route link href is/_console/apps/crm/accountwhile its text stays/apps/crm/account; an absolute url entry keepshttps://docs.example.com; controls at a root router and with no router give the bare path.Ablation (original
AppPreview.tsxrestored on disk, test file kept): 2 failed / 3 passed,expected '/apps/crm/' to be '/_console/apps/crm/'andexpected '/apps/crm/account' to be '/_console/apps/crm/account'; fix restored afterwards.Local readings at 8bff235
vitest runoverAppPreview*,adminPreviews*,ResourceEditPage.navDeepLink-11153(fromui/): Test Files 9 passed (9), Tests 95 passed (95).tsc --noEmit -p tsconfig.json(app-shell src): exit 0. eslint on the two files: 0 errors (7 pre-existingno-explicit-anywarnings on untouched lines).tsconfig.test.jsonrun hit the 4 GB heap cap (NOT MEASURED, CI); the same config narrowed to the new test file: exit 0.Acceptance notes
AppPreview.tsxRuntimeLink(the router/no-router branch) and the NavRowitem.externalbranch.Verification
Two-minute check:
objectstack dev --ui --seed-admininexamples/app-showcase, Studio, open any app, Preview, click Open: the new tab lands on/_console/apps/APP/, not a 404.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV