Skip to content

Commit c5f8588

Browse files
feat(ui): an approval opened with no source app stays in an app instead of Setup (#36546)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi92ncfFpPUpTD8314otX5oaG)_ Fixes #35505 Clause-②: no Metadata-protocol: none ## 维护者速读 - 审批人从首页「我的工作」、铃铛、通知或邮件链接打开一条审批时,不再默认进入系统设置应用,而是留在业务应用里:优先记录所属的应用,其次当前应用、上次用的应用、第一个应用;详情页的关闭和返回回到审批中心。 - 这是你对审批落点的裁决(选项 A),解决审批人被带进系统设置、处理后回到原始审批请求列表的问题。 - 普通审批人和管理员都会碰到;出错时最坏是审批打开在另一个业务应用里,审批本身照常可处理,改动可整体撤回。 - 无。 ## What changes The ruling (option A on the card) binds four items; each is implemented as follows. 1. **Where a request opened with no source app lands.** The order is the object's own app, then the current app, then the last used app, then the first app. - The last three steps are one resolver, `resolveApprovalsHostSegment(apps, current, last)` in `utils/appRoute.ts`. It reads the existing `resolveHostAppSegment` and the existing `LastAppProvider` (`useLastApp().lastApp`, the `ui.app.last` preference). No second host rule is added. - Home's 我的工作 (the inbox link, each pending row, and approval notices), and the bell (the same three), now host the inbox with it. Outside an app the last used app is consulted before the first app; inside an app the current app answers, as before. - The first step stays where it was: the deep link reads the request's `object_name` and asks `objectHostAppSegment`. That function gains `{ orSetup: false }`, which stops after "an app that lists the object". Without such an app the request now stays in the app it was opened in, instead of falling to Setup. - `/system/approvals…` still forwards to `/apps/setup/system/approvals…` (`SystemRedirect` stays a bare redirect, as its pin requires). `AppContent` now treats the `setup` **name alias** on exactly that inbox path as "no source app". Before any app chrome mounts, it waits at most 2 s for the last used app to be read, then replaces the URL with `/apps/HOST/system/approvals` plus the original search and hash (new file `console/setupAliasApprovals.ts`). Mounting first would record Setup as the reader's last app. The canonical-address rewrite is skipped on that path so the two do not race. 2. **The way back from a deep link, and the queue.** The deep link's redirect now carries history state: `from.pathname` is the approvals inbox of the app the request opens in, and `from.label` is the inbox title. The record page's ✕ and the phone's ‹ already follow `from.pathname`, so they return to the approvals centre, not to `/apps/APP/sys_approval_request`. `RecordDetailView.tsx` and `approvalQueueAdvance.tsx` are unchanged. - Home and the bell open a request with `approvalQueueState(...)` over the pending rows they hold, so the page draws the counter and 「处理后打开下一条」 works. The deep link keeps that queue and only rewrites `from.pathname` to the final app's inbox. - The e-mail link and a notification carry the way back alone (no queue). The server's link is unchanged; `approval-service.ts` is not touched. 3. **Setup by agreement.** When Setup is the current or the last used app, the resolver answers Setup, and the request stays there. `/apps/com.objectstack.setup/system/approvals` (Setup's own address) is never moved. Zero-app approvers are not handled, per the ruling. The `setup` fallback of an inbox mounted with no app segment is unchanged. 4. **The pinned test flips.** See below. ## Tests Pins that flip with this change (ruling item 4, and the sweep of the same rule): | File | Test | Before | After | |---|---|---|---| | `ui/apps/console/src/pages/system/ApprovalsInboxPage.opensServedPage-12484.test.tsx` | "no app lists the object: the request opens under Setup, never under the unrelated app" | `/apps/com.objectstack.setup/sys_approval_request/record/ID` | renamed "…stays in the app it was opened from, not Setup"; `/apps/probe_app/…` | | `ui/packages/app-shell/src/console/__tests__/AppContent.setupItemRoutesVerdict-12706.test.tsx` | "CONTROL — the approvals inbox stays reachable under the Setup segment for a refused caller" | inbox drawn at `/apps/setup/system/approvals` | renamed "…in the caller's own app"; asserts `/apps/crm/system/approvals`; the file header sentence updated | Changed because the call shape changed, not a flip: `HomePage.myWork-12602.test.tsx`, "opens a request in the Approvals inbox of the app the user is in". The same URL is now called with a second argument (the queue's history state), so the assertion takes `expect.objectContaining({ state: … approvalQueue: true })`. Two touched harnesses (`AppContent.setupItemRoutesVerdict-12706`, `HomePage.myWork-12602`) gained the module-top `import '@objectstack/lint'` that `check:test-source-alias` asks of an edited test file. Swept and deliberately **not** flipped: - `AppContent.setupObjectListVerdict-28988.test.tsx`, "CONTROL — a host route under the Setup segment is not read as an object list": its three assertions (inbox drawn, no denial, no probe) still hold. The inbox now draws after the move to the member's app. Left unchanged. - `record-pointer-card-renderer.test.tsx`, "no app lists the object: the record opens under Setup": this is a link to the **record** a request is about, not to the request. Its host rule (owner app, else Setup as the neutral context) is `objectHostAppSegment`'s default, and the ruling does not cover it. Not changed: its callers still get the Setup step. - `HomePage.approvalsTarget.test.tsx` names `/apps/setup/system/approvals` only in its history docblock; no assertion lands there. - `systemRedirectTarget.test.tsx` and `bootRedirectCoverage.test.tsx` pin `SystemRedirect`'s own hop, which is unchanged. - No doc under `content/docs/**` names this landing. New pins, each a top-level `describe` in the component's existing harness file: - `utils/__tests__/appRoute.test.ts`: `resolveApprovalsHostSegment`, the order tier by tier (current over last; last over first; an inactive current falls to last; neither answers, so the first app and not Setup ahead of it), Setup kept as current or last, the unloaded list. Also `isApprovalsInboxLink`, with a CONTROL. - `utils/__tests__/objectHostApp.test.ts`: `orSetup: false` stops after the owner app. - `ApprovalsInboxPage.opensServedPage-12484.test.tsx` (real inbox page plus real `RecordDetailView`): - the e-mail link's ✕ returns to the inbox, and no queue switch shows; - an open carrying Home's or the bell's queue shows 「Open next after deciding」, and ✕ returns to the inbox; - when the owner app is another, the way back is that app's inbox; - CONTROL: opened from Setup, it stays in Setup. - `HomePage.approvalsTarget.test.tsx`: last used app on a cold landing; current over last; Setup kept as last app; a pending row navigates with the queue state. - `InboxPopover.approvalsSegment-11818.test.tsx`: the same three tiers for the bell, plus CONTROL: the "see all" drill keeps the generic host. - `InboxPopover.rightPanel-34589.test.tsx`: "View details" hands the queue and the way back. CONTROL: "View all" hands none. - `AppContent.setupItemRoutesVerdict-12706.test.tsx`: the alias inbox moves through tiers 4, 3 and 2, keeping `?request=`; Setup as current is moved to Setup's own address; CONTROL: Setup's own address is not moved. <details><summary>Affected test files, local runs</summary> At 066d80c, 15 files: the 8 above, plus `systemRedirectTarget`, `bootRedirectCoverage`, `HomePage.notificationDeepLink`, `InboxPopover.notificationDeepLink`, `InboxPopover.unsavedEditsLeave-13253`, `InboxPopover.viewAllTarget` and `LastAppProvider`. ``` cd ui && pnpm exec vitest run --maxWorkers=2 FILES_15 Test Files 15 passed (15) Tests 192 passed (192) TESTEXIT=0 pnpm --filter @object-ui/app-shell run type-check -> TCEXIT=0 pnpm --filter @object-ui/console run type-check -> CONSOLE_TC=0 (at 6f01f71, after the ui closure build) ``` `HomePage.myWork-12602` was not measured locally: the shared verify lock was held by a sibling run, and two 540 s waits ended in exit 99. Its reading is CI's: Test UI (10/16) was red at 066d80c on that assertion, and is green at 1ed5095 and at the final head. </details> <details><summary>Ablation (one per changed behaviour; each mutation landed through scripts/ablation-replace.mjs, restored to the HEAD blob)</summary> - Remove `{ orSetup: false }` from the deep link: 1 failed / 13 passed. Fails "no app lists the object: the request stays in the app it was opened from, not Setup". - Drop `state={state}` from the deep link's redirect: 3 failed / 11 passed. Fails all three "way back / queue" cases. - Delete the alias `Navigate` in `AppContent`: 5 failed / 11 passed. Fails the flipped CONTROL, plus tiers 4, 3, 2 and the Setup-current case. - Home with `resolveHostAppSegment(activeApps, currentAppName)` in place of the approvals resolver: 3 failed / 6 passed. Fails the last-app, Setup-as-last and queue cases. Every leg ended with `blob == HEAD` and an empty `git diff HEAD`. </details> ## Acceptance notes - The queue Home hands on is the pending page Home holds, not only the five rows it shows. The bell's is the rows the panel lists (decided ones already dropped). When the queue runs out, the page goes to the inbox and says the list is done, as from the inbox. - `ui/packages/app-shell/README.md` (the "Setup's `system/*` pages" paragraph) still says a member reaches the approvals inbox under the Setup segment from the server's links. That README is outside this card's file surface, so it is left for the seat. - `PhoneAppNavBar.tsx` reads the generic host for its Approvals tab, but only inside an app, where the current app always answers, so it is unchanged. - The 2 s wait for the last used app mirrors the phone landing's wait. It applies only on the alias path, and only when the current app does not answer. ## Verification Read first: 1. `ui/packages/app-shell/src/console/AppContent.tsx`, the two early returns after the boot gate, and the canonical-rewrite effect's new guard. This is the one hop that runs before any chrome. 2. `ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx`, `RequestDeepLink` and `deepLinkRequestState`. 3. `ui/packages/app-shell/src/utils/appRoute.ts`, `resolveApprovalsHostSegment`. Two-minute check: as a member without Setup access whose last app is CRM, open `/system/approvals?request=ID` for a request whose object no app lists. Expect the request page under `/apps/CRM…`, not Setup; ✕ lands on `/apps/CRM…/system/approvals`. <details><summary>Gates at 1116647</summary> - Local: `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 39 families at 1116647. Each was run with stdin from /dev/null, exit taken before any pipe: 39 × exit 0. - `--ran` reconciliation: "39 derived, 39 run, 0 NOT-MEASURED, 0 UNRUN". - `node scripts/pm/overlap-check.mjs`: VERDICT clean exit 0. - `pnpm check:new-line-citations`: 0 new citations. - CI at 1116647: every required context passed — Lint & Repo Gates, TypeScript Type Check, Test Core, Governed Surface Queue Guard, Lint UI, Type Check UI, Test UI (16/16), Build & E2E UI, Live E2E UI, Dogfood Regression Gate. Check Changeset also passed. Build Core was skipped by its path selector. - Not run locally: the full `ui` package suites (CI's Test UI runs them) and `test:repo`. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmRB34k9WUWeGpRnVNm <!-- signed: repo:objectstack#2 · os-steve · session_01ADHkmRB34k9WUWeGpRnVNm --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent d463c46 commit c5f8588

17 files changed

Lines changed: 638 additions & 51 deletions
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@object-ui/console': patch
3+
---
4+
5+
fix(console): an approval request opened with no source app stays in an app instead of landing in Setup
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
An approval request opened from Home's My work, from the bell outside an app, from a notification or from the e-mail link used to open under the app whose navigation lists the request's record, and otherwise under Setup. It now opens in this order: the app that lists the record's object, then the current app, then the app the person last used, then the first app they can open. Setup is the answer only when it is the current or the last used app. The server's `/system/approvals?request=ID` link, which forwards through `/apps/setup/system/approvals`, moves on to that app too, and so does the approvals inbox opened there without a request.
11+
12+
On the request page reached this way, the close button and the phone's back link return to the approvals inbox of that app, not to the raw approval request list. A request opened from Home or from the bell is handed the pending queue they list, so the page counts through it and "Open next after deciding" moves on to the next request. The e-mail link and a notification carry only the way back.
13+
14+
`/apps/com.objectstack.setup/system/approvals`, Setup's own address, is unchanged.

‎ui/apps/console/src/pages/system/ApprovalsInboxPage.opensServedPage-12484.test.tsx‎

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import '@testing-library/jest-dom/vitest';
2626
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2727
import { render, screen, cleanup, fireEvent, within } from '@testing-library/react';
28-
import { MemoryRouter, Routes, Route, useLocation, useNavigate } from 'react-router-dom';
28+
import { MemoryRouter, Routes, Route, useLocation, useNavigate, type InitialEntry } from 'react-router-dom';
2929

3030
const { approvalsApiStub, ROW, AUTH } = vi.hoisted(() => {
3131
const ROW = {
@@ -82,7 +82,7 @@ vi.mock('../../services/approvalsApi', async (importOriginal) => ({
8282

8383
import { AdapterCtx, MetadataCtx, SchemaRendererProvider, useAdapter } from '@object-ui/react';
8484
import { I18nProvider, type I18nConfig } from '@object-ui/i18n';
85-
import { RecordDetailView } from '@object-ui/app-shell';
85+
import { RecordDetailView, approvalQueueState } from '@object-ui/app-shell';
8686
import { APPROVAL_STATUS_LABELS } from '@objectstack/spec/contracts';
8787
import { APPROVAL_ACTION_OBJECT, APPROVAL_REQUEST_OBJECT } from '../../services/approvalRequestsDataSource';
8888
import { ApprovalRecordReads } from '../../AppContent';
@@ -254,7 +254,7 @@ function RouterProbe() {
254254
);
255255
}
256256

257-
function renderAt(entries: string[]) {
257+
function renderAt(entries: InitialEntry[]) {
258258
return render(
259259
<I18nProvider config={EN} persistLanguage={false}>
260260
<MemoryRouter initialEntries={entries} initialIndex={entries.length - 1}>
@@ -416,10 +416,22 @@ describe('a request opened from no app (the deep link) opens in the app that own
416416
expect(where()).toBe(REQUEST_PAGE);
417417
});
418418

419-
it('no app lists the object: the request opens under Setup, never under the unrelated app', async () => {
419+
// objectstack#35505 (ruling option A, item 4) — flipped: this pinned "the
420+
// request opens under Setup". With no app listing the record's object, the
421+
// request now stays in the app the deep link was asked from (the current,
422+
// last used or first app), and Setup is no default.
423+
it('no app lists the object: the request stays in the app it was opened from, not Setup', async () => {
420424
setApps([CALLER, SETUP]);
421425
renderAt([`/apps/${APP}/home`, `${INBOX}?request=${REQ}`]);
422426

427+
await servedPage();
428+
expect(where()).toBe(REQUEST_PAGE);
429+
});
430+
431+
it('CONTROL: opened from Setup (its current or last used app), the request may stay there', async () => {
432+
setApps([CALLER, SETUP]);
433+
renderAt([`/apps/com.objectstack.setup/home`, `/apps/com.objectstack.setup/system/approvals?request=${REQ}`]);
434+
423435
await servedPage();
424436
expect(where()).toBe(pageUnder('com.objectstack.setup'));
425437
});
@@ -433,3 +445,54 @@ describe('a request opened from no app (the deep link) opens in the app that own
433445
expect(where()).toBe(REQUEST_PAGE);
434446
});
435447
});
448+
449+
describe('a deep-linked request returns to the approvals inbox, and carries the queue it was opened with (objectstack#35505)', () => {
450+
/** The ✕ at the end of the request page's top bar. */
451+
const closeButton = () => screen.findByTestId('record-page-close', undefined, { timeout: 8000 });
452+
const OTHER = 'req_other';
453+
454+
it('the e-mail link (no state): ✕ goes back to the approvals inbox, not the raw request list', async () => {
455+
renderAt([`${INBOX}?request=${REQ}`]);
456+
await servedPage();
457+
expect(where()).toBe(REQUEST_PAGE);
458+
// The link carries the way back alone: no queue, so no 「处理后打开下一条」.
459+
expect(screen.queryByTestId('approval-queue-open-next')).toBeNull();
460+
461+
fireEvent.click(await closeButton());
462+
expect(where()).toBe(INBOX);
463+
expect(where()).not.toBe(`/apps/${APP}/${APPROVAL_REQUEST_OBJECT}`);
464+
});
465+
466+
it("Home's and the bell's open hands the pending queue on: the switch shows, and ✕ still goes to the inbox", async () => {
467+
renderAt([
468+
{
469+
pathname: INBOX,
470+
search: `?request=${REQ}`,
471+
state: approvalQueueState({ pathname: INBOX, label: 'Approvals Inbox' }, [REQ, OTHER]),
472+
},
473+
]);
474+
await servedPage();
475+
expect(where()).toBe(REQUEST_PAGE);
476+
expect(await screen.findByTestId('approval-queue-open-next')).toBeInTheDocument();
477+
478+
fireEvent.click(await closeButton());
479+
expect(where()).toBe(INBOX);
480+
});
481+
482+
it('the way back names the inbox of the app the request opens in, when the owner app is another', async () => {
483+
(metadata as { apps: unknown[] }).apps = [
484+
{ name: APP, navigation: [{ type: 'object', objectName: 'leave_request' }] },
485+
{ name: 'finance', _packageId: 'com.example.finance', navigation: [{ type: 'object', objectName: ROW.object_name }] },
486+
];
487+
try {
488+
renderAt([`${INBOX}?request=${REQ}`]);
489+
await servedPage();
490+
expect(where()).toBe(`/apps/com.example.finance/${APPROVAL_REQUEST_OBJECT}/record/${REQ}`);
491+
492+
fireEvent.click(await closeButton());
493+
expect(where()).toBe('/apps/com.example.finance/system/approvals');
494+
} finally {
495+
(metadata as { apps: unknown[] }).apps = [];
496+
}
497+
});
498+
});

‎ui/apps/console/src/pages/system/ApprovalsInboxPage.tsx‎

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -732,23 +732,45 @@ function InlineActions({
732732
* `sys_approval_request`, where `RecordDetailView` mounts the page objectstack
733733
* serves for it (`sys_approval_request_detail`).
734734
*
735-
* The app segment is the app that owns the request's RECORD
736-
* (`objectHostAppSegment`, objectstack#32667): the app it is asked from when
737-
* that app lists the record's object, else the first app that does, else
738-
* Setup. A request opened under an app whose navigation never names the
739-
* record's object drew that app's sidebar around it, and its record card could
740-
* not reach the record. Only when the reader can open no such app, nor Setup,
741-
* does the request stay in the app it was asked from (or `setup` outside one,
742-
* as the row's record link falls back).
735+
* The app segment is the app that owns the request's RECORD when one does: the
736+
* app it is asked from when that app lists the record's object, else the first
737+
* app that does (`objectHostAppSegment` without its Setup step). When no app
738+
* lists the object the request stays in the app it is asked from, which for an
739+
* open with no source app is the current, last used or first app
740+
* (`resolveApprovalsHostSegment`, objectstack#35505): Setup only when it is
741+
* that app. An inbox with no app segment (the zero-app route set) keeps `setup`.
743742
*/
744743
function requestPagePath(
745744
apps: readonly Record<string, unknown>[] | undefined,
746745
objectName: string | null | undefined,
747746
appName: string | undefined,
748747
requestId: string,
749748
): string {
750-
const segment = objectHostAppSegment(apps, objectName, appName) ?? (appName || 'setup');
751-
return `/apps/${segment}/${APPROVAL_REQUEST_OBJECT}/record/${encodeURIComponent(requestId)}`;
749+
return `/apps/${requestPageSegment(apps, objectName, appName)}/${APPROVAL_REQUEST_OBJECT}/record/${encodeURIComponent(requestId)}`;
750+
}
751+
752+
function requestPageSegment(
753+
apps: readonly Record<string, unknown>[] | undefined,
754+
objectName: string | null | undefined,
755+
appName: string | undefined,
756+
): string {
757+
return objectHostAppSegment(apps, objectName, appName, { orSetup: false }) ?? (appName || 'setup');
758+
}
759+
760+
/**
761+
* The history state a deep link opens the request page with: the way back is
762+
* the approvals inbox of the app the page opens in, never the object's raw
763+
* `sys_approval_request` list (objectstack#35505). The page's ✕ and the phone's
764+
* ‹ follow `from.pathname`. A queue handed in by the opener (Home's 我的工作,
765+
* the bell: `approvalQueueState`) rides along, so 「处理后打开下一条」 moves on
766+
* through it; an open that hands none (a notification, the e-mail link) carries
767+
* the way back alone.
768+
*/
769+
function deepLinkRequestState(incoming: unknown, inboxPath: string, inboxLabel: string): Record<string, unknown> {
770+
const base = incoming && typeof incoming === 'object' ? (incoming as Record<string, unknown>) : {};
771+
const from = base.from && typeof base.from === 'object' ? (base.from as Record<string, unknown>) : {};
772+
const label = typeof from.label === 'string' && from.label ? from.label : inboxLabel;
773+
return { ...base, from: { ...from, pathname: inboxPath, label } };
752774
}
753775

754776
/**
@@ -776,6 +798,8 @@ export function ApprovalsInboxPage() {
776798
*/
777799
function RequestDeepLink({ requestId }: { requestId: string }) {
778800
const { appName } = useParams<{ appName?: string }>();
801+
const location = useLocation();
802+
const { t } = useObjectTranslation();
779803
const { apps, loading } = useMetadata();
780804
const catalog = Array.isArray(apps) ? (apps as Record<string, unknown>[]) : undefined;
781805
const choose = !loading && !!catalog && catalog.length > 0;
@@ -800,9 +824,15 @@ function RequestDeepLink({ requestId }: { requestId: string }) {
800824
}, [choose, requestId]);
801825

802826
if (loading) return null;
803-
if (!choose) return <Navigate to={requestPagePath(catalog, null, appName, requestId)} replace />;
804-
if (answer?.requestId !== requestId) return null;
805-
return <Navigate to={requestPagePath(catalog, answer.objectName, appName, requestId)} replace />;
827+
if (choose && answer?.requestId !== requestId) return null;
828+
const objectName = choose ? (answer?.objectName ?? null) : null;
829+
const segment = requestPageSegment(catalog, objectName, appName);
830+
const state = deepLinkRequestState(
831+
location.state,
832+
`/apps/${segment}/system/approvals`,
833+
String(t('approvalsInbox.title', { defaultValue: 'Approvals Inbox' })),
834+
);
835+
return <Navigate to={requestPagePath(catalog, objectName, appName, requestId)} replace state={state} />;
806836
}
807837

808838
function ApprovalsQueue() {

‎ui/packages/app-shell/src/console/AppContent.tsx‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import {
6969
navEntriesShownOncePendingReadsShow,
7070
} from '../hooks/useNavMemberGates.js';
7171
import { resolveSetupAppPath } from './ConsoleShell.js';
72+
import { useSetupAliasApprovalsTarget } from './setupAliasApprovals.js';
7273
import { APP_ROUTE_METADATA_READS, collectRoutePaths, metadataReadsForAppRoute } from './appRouteMetadataReads.js';
7374
import { enterAppBundle, objectViewRouteObject, prefetchObjectViewRows, readAppObjectScope } from './appObjectScope.js';
7475
import { preferLocal } from '../utils/preferLocal.js';
@@ -469,13 +470,17 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
469470
// so Back never returns to the alias. An effect rather than a `<Navigate>`
470471
// return, so a layout already on screen is not unmounted for the swap.
471472
const canonicalPathname = canonicalAppPathname(apps, appName, location.pathname);
473+
// objectstack#35505 — the inbox under the `setup` alias names no source app:
474+
// it moves to the reader's approvals host below instead of onto Setup's
475+
// address (`setupAliasApprovals.ts`).
476+
const setupAliasApprovalsTarget = useSetupAliasApprovalsTarget();
472477
useEffect(() => {
473-
if (!canonicalPathname) return;
478+
if (!canonicalPathname || setupAliasApprovalsTarget !== undefined) return;
474479
navigate(`${canonicalPathname}${location.search}${location.hash}`, {
475480
replace: true,
476481
state: location.state,
477482
});
478-
}, [canonicalPathname, location.search, location.hash, location.state, navigate]);
483+
}, [canonicalPathname, setupAliasApprovalsTarget, location.search, location.hash, location.state, navigate]);
479484

480485
// objectui#12809 — the lazy metadata buckets the CURRENT route reads at
481486
// render (`appRouteMetadataReads.ts` declares them per route). This used to
@@ -654,11 +659,11 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
654659
// probe change nothing.
655660
//
656661
// ⛔ Not the rest of the Setup subtree. `/system/*` links forward onto
657-
// `/apps/setup/system/*` (`SystemRedirect`, `ConsoleShell.tsx`), the server's
658-
// approval links (`/system/approvals?request=`) among them, and that inbox
659-
// opens records at `/apps/setup/OBJECT/record/ID` (`ApprovalsInboxPage`'s
660-
// `recordHref`). A member reaches both under the Setup segment, so whether
661-
// they wait on Setup's verdict is a product decision, left open on
662+
// `/apps/setup/system/*` (`SystemRedirect`, `ConsoleShell.tsx`). The server's
663+
// approval links (`/system/approvals?request=`) among them move on from there
664+
// to the reader's own app (`setupAliasApprovals.ts`, objectstack#35505), but
665+
// an older record link may still name `/apps/setup/OBJECT/record/ID`, so
666+
// whether those wait on Setup's verdict is a product decision, left open on
662667
// objectui#12706.
663668
//
664669
// objectstack#27507 — two more wait on it: the settings pages
@@ -1245,6 +1250,10 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
12451250
// objectstack#35981 — and the deployment flags (`featuresSettled`, above):
12461251
// the chrome's navigation gates read them.
12471252
if (!dataSource || metadataLoading || !isWorkspaceAdminResolved || !featuresSettled) return <ConsoleBootShell />;
1253+
// objectstack#35505 — before any app's chrome mounts (which would record
1254+
// Setup as the reader's last app), the alias inbox moves to its host.
1255+
if (setupAliasApprovalsTarget === 'waiting') return <ConsoleBootShell />;
1256+
if (setupAliasApprovalsTarget) return <Navigate to={setupAliasApprovalsTarget} replace state={location.state} />;
12481257
if (routeReadsSettled) firstRouteDrawn.current = true;
12491258

12501259
// ADR-0037 — preview mode renders its OWN empty/error states and never

‎ui/packages/app-shell/src/console/ConsoleShell.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,10 @@ export function AuthenticatedRoute({
581581
/**
582582
* SystemRedirect — forwards legacy /system/* URLs to the canonical
583583
* /apps/setup/system/* location so bookmarks keep working. Suffix is preserved.
584+
* The approvals inbox does not stay there: `AppContent` moves
585+
* `/apps/setup/system/approvals` on to the reader's own app
586+
* (`setupAliasApprovals.ts`, objectstack#35505), so the server's approval
587+
* links land in an app rather than in Setup.
584588
*
585589
* #3611 — the bare `/system` bookmark used to land on the bare `/apps/setup`,
586590
* which on a zero-app deployment is the "No Apps Configured" empty state's own

0 commit comments

Comments
 (0)