diff --git a/.changeset/36732-desktop-lands-in-last-app.md b/.changeset/36732-desktop-lands-in-last-app.md
new file mode 100644
index 00000000000..512202e90eb
--- /dev/null
+++ b/.changeset/36732-desktop-lands-in-last-app.md
@@ -0,0 +1,23 @@
+---
+'@object-ui/console': patch
+'@object-ui/app-shell': patch
+'@object-ui/auth': patch
+'@object-ui/i18n': patch
+---
+
+feat(console): from 768 px up a sign-in lands in the last-used app, and the platform home page retires
+
+Clause-②: yes (widening)
+Metadata-protocol: none
+
+From 768 px up there is no platform home page any more. A sign-in, the SSO round trip and the old `/home` address all land the person in an app their permission sets show, in this order: the app they last had open, while it is still there for them; else the app the product declares `isDefault`; else the first app somebody put into the environment (never Setup or Studio).
+
+- A person with no such app at all stays on `/home`, which now draws only the no-apps empty state: 「No applications yet」, and for a viewer who may add an app the same doors the sidebar's 「Add app」 offers (build with AI, start from a template, the app marketplace). An administrator's first-run checklist stays above it.
+- An administrator's first-run checklist, while it has open items, moves to the top of the Setup app's first page (the page Setup opens on). It is drawn from 768 px up only, and a phone is unchanged.
+- `@object-ui/app-shell` exports `SetupFirstPageSlotProvider`, through which a host puts its element above the Setup app's first page.
+- The console's Home affordances (⌘⇧H, the way back from a missing app, Studio's way out) go where the landing goes. Where the chrome cannot yet tell which apps a permission set hides (Studio, the AI pages, or before that answer arrives) they point at `/home`, which resolves the landing itself.
+- The SSO sign-in's callback is the console root instead of `/home`, so it lands the same way.
+- A phone is unchanged: it still lands in the last app first, and `/home` is still its app list.
+- `@object-ui/app-shell` exports `resolveDesktopHomePath(apps, lastApp)`, the desktop's Home.
+- `RedirectWithSplash` takes an optional `state`, so the hops from `/` and `/home` into the landing app keep what the visit carried (an old `/ai` address's Builder handoff).
+- Every console locale gains `home.noAppsAddDescription`.
diff --git a/ui/apps/console/src/App.tsx b/ui/apps/console/src/App.tsx
index e30d8fa5e80..315c2dc747a 100644
--- a/ui/apps/console/src/App.tsx
+++ b/ui/apps/console/src/App.tsx
@@ -40,6 +40,7 @@ import {
DefaultSettingsPage,
DefaultAcceptInvitationPage,
useMetadata,
+ usePhoneViewport,
} from '@object-ui/app-shell';
import { AppContent, ConsolePermissionsRequest, ConsolePermissionsScope } from './AppContent';
@@ -205,14 +206,22 @@ function homeChecklist(placement: FirstRunChecklistPlacement) {
* apps on a phone (objectstack#34596). The route sits under
* `ConsolePermissionsScope`, which is what tells the checklist whether this
* session may write the settings it lists; for anyone else it draws nothing.
+ *
+ * From 768 px up the platform home page is retired (objectstack#36732): the
+ * address resolves like `/` does on a desktop and redirects into the
+ * last-used app, the declared default or the first product app, and draws the
+ * page — its no-apps empty state — only for a viewer with no product app. A
+ * phone keeps its app list here, unchanged.
*/
function HomeRoute() {
const { user } = useAuth();
- return (
+ const phone = usePhoneViewport();
+ const page = (
);
+ return phone ? page : ;
}
/**
diff --git a/ui/apps/console/src/AppContent.tsx b/ui/apps/console/src/AppContent.tsx
index 00a9c8c6949..6c3a3ff72c9 100644
--- a/ui/apps/console/src/AppContent.tsx
+++ b/ui/apps/console/src/AppContent.tsx
@@ -11,12 +11,13 @@
import { lazy, Suspense, useEffect, useMemo, type ReactNode } from 'react';
import { Route, useParams, useLocation, Navigate } from 'react-router-dom';
-import { DefaultAppContent, ENVIRONMENT_SCOPE_QUERY, LauncherAppsProvider, LoadingFallback, LoadingScreen, setupMetadataStudioPath, useAdapter } from '@object-ui/app-shell';
+import { DefaultAppContent, ENVIRONMENT_SCOPE_QUERY, LauncherAppsProvider, LoadingFallback, LoadingScreen, SetupFirstPageSlotProvider, setupMetadataStudioPath, useAdapter } from '@object-ui/app-shell';
import { AdapterCtx } from '@object-ui/react';
import { MePermissionsProvider, ServerReadScope, releaseMePermissionsRequest, startMePermissionsRequest } from '@object-ui/permissions';
import { createAuthenticatedFetch, useAuth } from '@object-ui/auth';
import type { DataSource } from '@object-ui/types';
import { LocalizationFetchProvider } from './LocalizationFetchProvider';
+import { FirstRunChecklist } from './pages/settings/FirstRunChecklist';
import { InAppFormRoute } from './components/InternalFormRoute';
import { APPROVAL_ACTION_OBJECT, APPROVAL_REQUEST_OBJECT, routeApprovalRecordReads } from './services/approvalRequestsDataSource';
@@ -417,6 +418,17 @@ export function ConsolePermissionsRequest(): null {
return null;
}
+/**
+ * objectstack#36732 (item 5, option A) — an administrator's first-run
+ * checklist at the top of the Setup app's first page, now that the desktop's
+ * home page retired. The checklist decides who sees it (a session that may
+ * write the settings it lists) and hides once the list is done; this route
+ * sits under `ConsolePermissionsScope`, which answers the first.
+ */
+function setupFirstPageChecklist() {
+ return ;
+}
+
/**
* The console's ONE `/auth/me/permissions` source, shared by Home and every app
* (objectui#12700).
@@ -524,10 +536,12 @@ export function AppContent() {
<>
-
+
+
+
>
diff --git a/ui/apps/console/src/__tests__/App.homePermissions-12700.test.tsx b/ui/apps/console/src/__tests__/App.homePermissions-12700.test.tsx
index 61db402a297..a95ef69dbbe 100644
--- a/ui/apps/console/src/__tests__/App.homePermissions-12700.test.tsx
+++ b/ui/apps/console/src/__tests__/App.homePermissions-12700.test.tsx
@@ -167,6 +167,10 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({
// boot fallback, which is the splash off an app route.
LoadingFallback: () =>
,
DefaultHomePage: () => ,
+ // objectstack#36732 — from 768 px up `/home` redirects into an app; the page
+ // these cases read is a phone's (and a desktop's with no product app), so
+ // they render at phone width.
+ usePhoneViewport: () => true,
DefaultAppContent: () => ,
BuilderLanding: () => ,
StudioDesignSurface: () => ,
diff --git a/ui/apps/console/src/__tests__/App.nativeShellMode-29039.test.tsx b/ui/apps/console/src/__tests__/App.nativeShellMode-29039.test.tsx
index d9d375c7e43..896d50d3688 100644
--- a/ui/apps/console/src/__tests__/App.nativeShellMode-29039.test.tsx
+++ b/ui/apps/console/src/__tests__/App.nativeShellMode-29039.test.tsx
@@ -86,6 +86,10 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({
SystemRedirect: () => null,
DefaultHomeLayout: passthrough,
DefaultHomePage: stub('home-page'),
+ // objectstack#36732 — from 768 px up `/home` redirects into an app; the page
+ // these cases read is a phone's (and a desktop's with no product app), so
+ // they render at phone width.
+ usePhoneViewport: () => true,
DefaultOrganizationsLayout: passthrough,
DefaultOrganizationsPage: stub('organizations-page'),
DefaultOrganizationLayout: stub('organization-layout'),
diff --git a/ui/apps/console/src/__tests__/App.permissionsWave-29114.test.tsx b/ui/apps/console/src/__tests__/App.permissionsWave-29114.test.tsx
index f2bdf38d704..027923cdce9 100644
--- a/ui/apps/console/src/__tests__/App.permissionsWave-29114.test.tsx
+++ b/ui/apps/console/src/__tests__/App.permissionsWave-29114.test.tsx
@@ -134,6 +134,10 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => {
LoadingScreen: () => ,
DefaultHomeLayout: ({ children }: { children?: ReactNode }) => <>{children}>,
DefaultHomePage: () => ,
+ // objectstack#36732 — from 768 px up `/home` redirects into an app; the page
+ // these cases read is a phone's (and a desktop's with no product app), so
+ // they render at phone width.
+ usePhoneViewport: () => true,
DefaultAppContent: () => ,
DefaultOrganizationsLayout: ({ children }: { children?: ReactNode }) => <>{children}>,
DefaultOrganizationsPage: () => ,
diff --git a/ui/apps/console/src/components/FormPage.routePermissions-29187.test.tsx b/ui/apps/console/src/components/FormPage.routePermissions-29187.test.tsx
index 820b1c332cf..975ccbe4206 100644
--- a/ui/apps/console/src/components/FormPage.routePermissions-29187.test.tsx
+++ b/ui/apps/console/src/components/FormPage.routePermissions-29187.test.tsx
@@ -128,6 +128,10 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({
// boot fallback, which is the splash off an app route.
LoadingFallback: () => ,
DefaultHomePage: () => ,
+ // objectstack#36732 — from 768 px up `/home` redirects into an app; the page
+ // these cases read is a phone's (and a desktop's with no product app), so
+ // they render at phone width.
+ usePhoneViewport: () => true,
DefaultAppContent: () => null,
BuilderLanding: () => null,
StudioDesignSurface: () => null,
diff --git a/ui/apps/console/src/components/RootLandingRedirect.route.test.tsx b/ui/apps/console/src/components/RootLandingRedirect.route.test.tsx
index f428a0a7bb5..b8de3cc8f03 100644
--- a/ui/apps/console/src/components/RootLandingRedirect.route.test.tsx
+++ b/ui/apps/console/src/components/RootLandingRedirect.route.test.tsx
@@ -87,6 +87,13 @@ const phone = vi.hoisted(() => ({
value: { isPhone: false, lastApp: null as string | null, settled: true },
}));
+/**
+ * objectstack#36732 — the member's `/me/apps` answer, as the launcher hooks
+ * serve it: the names a permission set hides, and whether the first read is
+ * still out. The real narrowing is pinned beside `useLauncherApps`.
+ */
+const served = vi.hoisted(() => ({ value: { hidden: [] as string[], pending: false } }));
+
/** The auth verdict each case varies. */
const auth = vi.hoisted(() => ({
value: { isAuthenticated: false, isLoading: false, user: null as any },
@@ -106,13 +113,18 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({
// pinned where the real component lives —
// `packages/app-shell/src/chrome/RedirectWithSplash.test.tsx` — and
// end-to-end by `e2e/console-boot-indicator.spec.ts`.
- RedirectWithSplash: ({ to, replace }: { to: string; replace?: boolean }) => (
+ RedirectWithSplash: ({ to, replace, state }: { to: string; replace?: boolean; state?: unknown }) => (
<>
-
+
>
),
usePhoneViewport: () => phone.value.isPhone,
+ useServedApps: (apps: any[]) => (apps ?? []).filter((app) => !served.value.hidden.includes(app?.name)),
+ useLauncherApps: (apps: any[] | undefined) => ({
+ apps: (apps ?? []).filter((app) => !served.value.hidden.includes(app?.name)),
+ pending: served.value.pending,
+ }),
useLastApp: () => ({ lastApp: phone.value.lastApp, settled: phone.value.settled, rememberApp: () => {} }),
SETUP_APP_PACKAGE_ID: 'com.objectstack.setup',
SETUP_APP_NAME: 'setup',
@@ -146,6 +158,7 @@ function LocationProbe() {
<>
{location.pathname + location.search}
{location.hash}
+
{JSON.stringify(location.state ?? null)}
>
);
}
@@ -169,7 +182,19 @@ function renderAt(entry: string) {
}
/>
{/* The destinations. Each is a sink: reaching it IS the assertion. */}
- } />
+ {/* `/home` as App.tsx's HomeRoute mounts it: the page on a phone, and
+ from 768 px up the desktop resolver, which `/` hands off to
+ (objectstack#36732). The page is a sink either way. */}
+
+ ) : (
+ } />
+ )
+ }
+ />
} />
} />
{/* A protected deep link, so redirect CAPTURE can be measured too. */}
@@ -195,6 +220,7 @@ beforeEach(() => {
metadata.value = { apps: [], loading: false, status: 'ready', refresh: vi.fn(async () => {}) };
auth.value = { isAuthenticated: false, isLoading: false, user: null };
phone.value = { isPhone: false, lastApp: null, settled: true };
+ served.value = { hidden: [], pending: false };
});
// ── (b) The control QA used to isolate the defect ────────────────────────
@@ -260,14 +286,24 @@ describe('a genuinely empty app list still falls through to /home', () => {
expect(screen.getByTestId('home-launcher')).toBeTruthy();
});
- it('lands on the launcher for a multi-app deployment with no isDefault', () => {
+ it('a phone lands on its app list for a multi-app deployment with no isDefault', () => {
auth.value.isAuthenticated = true;
+ phone.value = { isPhone: true, lastApp: null, settled: true };
metadata.value.apps = [OTHER_APP, { name: 'ops_app' }];
renderAt('/');
expect(location()).toBe('/home');
});
+
+ it('objectstack#36732 — a desktop lands in the first app of a multi-app deployment with no isDefault', () => {
+ auth.value.isAuthenticated = true;
+ metadata.value.apps = [OTHER_APP, { name: 'ops_app' }];
+
+ renderAt('/');
+
+ expect(location()).toBe('/apps/showcase_app');
+ });
});
// ── THE FIX (red-first) — an error-state list is UNKNOWN, not empty ──────
@@ -282,7 +318,9 @@ describe('app fetch failed — the resolver produces no conclusion', () => {
renderAt('/');
- expect(location()).toBe('/');
+ // objectstack#36732 — from 768 px up `/` hands off to `/home`, the desktop
+ // resolver, which is the address a reload re-resolves; it draws no page.
+ expect(location()).toBe('/home');
expect(screen.queryByTestId('home-launcher')).toBeNull();
expect(screen.getByTestId('loading-fallback')).toBeTruthy();
});
@@ -291,6 +329,8 @@ describe('app fetch failed — the resolver produces no conclusion', () => {
// `Navigate … replace` is what made the wrong answer permanent: it rewrites
// `/` to `/home`, and every later entry (reload, Back, a captured
// `?redirect=`) starts from the wrong path instead of re-running the policy.
+ // On a phone, where `/home` is a page and not a resolver (objectstack#36732).
+ phone.value.isPhone = true;
auth.value.isAuthenticated = true;
metadata.value.apps = [];
metadata.value.status = 'error';
@@ -331,7 +371,9 @@ describe('app fetch failed — the resolver produces no conclusion', () => {
renderAt('/');
- expect(location()).toBe('/');
+ // From 768 px up the wait is `/home`'s, which `/` hands off to (objectstack#36732).
+ expect(location()).toBe('/home');
+ expect(screen.queryByTestId('home-launcher')).toBeNull();
expect(screen.getByTestId('loading-fallback')).toBeTruthy();
});
@@ -381,7 +423,7 @@ describe('the landing carries the query and hash `/` arrived with', () => {
it('lands on the launcher with the query kept too', () => {
auth.value.isAuthenticated = true;
- metadata.value.apps = [OTHER_APP, { name: 'ops_app' }];
+ metadata.value.apps = [{ name: 'setup', _packageId: 'com.objectstack.setup' }];
renderAt('/?palette=1');
@@ -434,9 +476,123 @@ describe('a phone lands in the app the person used last (objectstack#35881)', ()
}
});
- it('CONTROL — a desktop ignores the last app and keeps the declared default', () => {
+ it('objectstack#36732 — a desktop lands in the last app too, ahead of the declared default', () => {
phone.value = { isPhone: false, lastApp: 'showcase_app', settled: true };
renderAt('/');
+ expect(location()).toBe('/apps/showcase_app');
+ });
+
+ it('objectstack#36732 — a desktop waits for the record too, then resolves without it after the wait', () => {
+ vi.useFakeTimers();
+ try {
+ phone.value = { isPhone: false, lastApp: null, settled: false };
+ renderAt('/');
+ expect(location()).toBe('/home');
+ expect(screen.getByTestId('loading-fallback')).toBeInTheDocument();
+ act(() => {
+ vi.advanceTimersByTime(2000);
+ });
+ expect(location()).toBe('/apps/crm_app');
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+});
+
+// ── objectstack#36732 — the retired `/home` address on a desktop ────────────
+describe('the retired /home address redirects into an app (objectstack#36732)', () => {
+ /** The `/home` route as App.tsx mounts it on a desktop: the resolver with the no-apps page. */
+ function renderHome(entry: string | { pathname: string; state?: unknown }) {
+ return render(
+
+
+
+ } />}
+ />
+ } />
+
+ ,
+ );
+ }
+
+ beforeEach(() => {
+ auth.value.isAuthenticated = true;
+ });
+
+ it('opening /home lands in the last-used app, keeping the query', () => {
+ metadata.value.apps = [OTHER_APP, DEFAULT_APP];
+ phone.value = { isPhone: false, lastApp: 'showcase_app', settled: true };
+ renderHome('/home?palette=1');
+ expect(location()).toBe('/apps/showcase_app?palette=1');
+ expect(screen.queryByTestId('home-no-apps-page')).toBeNull();
+ });
+
+ it('carries the visit\'s navigation state on to the app (an old /ai address\'s Builder handoff)', () => {
+ // `AiAddressRedirect` and the chrome's Home outside the `/me/apps`
+ // provider name `/home`; what their visit carries must survive the hop.
+ metadata.value.apps = [OTHER_APP, DEFAULT_APP];
+ renderHome({ pathname: '/home', state: { handoff: { prompt: 'Build a CRM' } } });
expect(location()).toBe('/apps/crm_app');
+ expect(screen.getByTestId('location-state').textContent).toBe('{"handoff":{"prompt":"Build a CRM"}}');
+ });
+
+ it('with no record it lands in the declared default, else the first app', () => {
+ metadata.value.apps = [OTHER_APP, DEFAULT_APP];
+ renderHome('/home');
+ expect(location()).toBe('/apps/crm_app');
+ });
+
+ it('a viewer with no product app stays on /home and is drawn the no-apps page', () => {
+ metadata.value.apps = [{ name: 'setup', _packageId: 'com.objectstack.setup' }];
+ renderHome('/home');
+ expect(location()).toBe('/home');
+ expect(screen.getByTestId('home-no-apps-page')).toBeInTheDocument();
+ });
+
+ it('never lands in an app a permission set hides: the first app it shows instead', () => {
+ // The contract review's case: `[hr, sales]`, no default, `hr` hidden by the sales rep's set.
+ metadata.value.apps = [{ name: 'hr' }, { name: 'sales' }];
+ served.value = { hidden: ['hr'], pending: false };
+ renderAt('/');
+ expect(location()).toBe('/apps/sales');
+ });
+
+ it('skips a last app a permission set now hides', () => {
+ metadata.value.apps = [{ name: 'hr' }, { name: 'sales' }];
+ served.value = { hidden: ['hr'], pending: false };
+ phone.value = { isPhone: false, lastApp: 'hr', settled: true };
+ renderHome('/home');
+ expect(location()).toBe('/apps/sales');
+ });
+
+ it('a member whose sets hide every product app gets the no-apps page, not a hidden app', () => {
+ metadata.value.apps = [{ name: 'setup', _packageId: 'com.objectstack.setup' }, { name: 'hr' }];
+ served.value = { hidden: ['hr'], pending: false };
+ renderHome('/home');
+ expect(location()).toBe('/home');
+ expect(screen.getByTestId('home-no-apps-page')).toBeInTheDocument();
+ });
+
+ it('waits while the `/me/apps` answer is out, then lands', () => {
+ metadata.value.apps = [{ name: 'hr' }, { name: 'sales' }];
+ served.value = { hidden: [], pending: true };
+ const { rerender } = renderHome('/home');
+ expect(location()).toBe('/home');
+ expect(screen.getByTestId('loading-fallback')).toBeInTheDocument();
+ served.value = { hidden: ['hr'], pending: false };
+ rerender(<>>);
+ renderHome('/home');
+ expect(location()).toBe('/apps/sales');
+ });
+
+ it('CONTROL: an app list that failed to load draws neither — it waits, as `/` does', () => {
+ metadata.value.apps = [];
+ metadata.value.status = 'error';
+ renderHome('/home');
+ expect(location()).toBe('/home');
+ expect(screen.queryByTestId('home-no-apps-page')).toBeNull();
+ expect(screen.getByTestId('loading-fallback')).toBeInTheDocument();
});
});
diff --git a/ui/apps/console/src/components/RootLandingRedirect.test.ts b/ui/apps/console/src/components/RootLandingRedirect.test.ts
index c1060144ad5..086cd858726 100644
--- a/ui/apps/console/src/components/RootLandingRedirect.test.ts
+++ b/ui/apps/console/src/components/RootLandingRedirect.test.ts
@@ -1,7 +1,12 @@
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
import { describe, it, expect } from 'vitest';
-import { resolveLandingPath, resolvePhoneLandingPath, isAppListConclusive } from './RootLandingRedirect';
+import {
+ resolveLandingPath,
+ resolvePhoneLandingPath,
+ resolveDesktopLandingPath,
+ isAppListConclusive,
+} from './RootLandingRedirect';
describe('resolveLandingPath', () => {
it('routes to the App marked isDefault (isDefault now ROUTES, not just badges)', () => {
@@ -224,7 +229,63 @@ describe('resolvePhoneLandingPath — the last app first, then the desktop order
).toBe('/apps/cloud_control');
});
- it('CONTROL — the desktop resolver does not read the last app', () => {
+ it('CONTROL — the phone\'s no-record order does not read the last app', () => {
expect(resolveLandingPath(APPS)).toBe('/apps/cloud_control');
});
});
+
+// objectstack#36732 — from 768 px up the platform home page is retired: the
+// last-used app, then the declared default, then the first PRODUCT app; only a
+// viewer with no product app is left on /home (its no-apps empty state).
+describe('resolveDesktopLandingPath — the retired home page lands in an app', () => {
+ const SETUP = { name: 'setup', _packageId: 'com.objectstack.setup' };
+ const STUDIO = { name: 'studio', _packageId: 'com.objectstack.studio' };
+ const APPS = [
+ SETUP,
+ { name: 'crm', _packageId: 'com.acme.crm' },
+ { name: 'cloud_control', isDefault: true },
+ { name: 'service' },
+ ];
+
+ it('the last-used app beats the declared default', () => {
+ expect(resolveDesktopLandingPath(APPS, 'service')).toBe('/apps/service');
+ expect(resolveDesktopLandingPath(APPS, 'crm')).toBe('/apps/com.acme.crm');
+ });
+
+ it('a last-used Setup is still where the person was', () => {
+ expect(resolveDesktopLandingPath(APPS, 'setup')).toBe('/apps/com.objectstack.setup');
+ });
+
+ it('no record yet: the declared default', () => {
+ expect(resolveDesktopLandingPath(APPS, null)).toBe('/apps/cloud_control');
+ });
+
+ it('THE FIX: no record and no default — the first product app, not /home', () => {
+ expect(resolveDesktopLandingPath([SETUP, { name: 'a' }, { name: 'b' }], null)).toBe('/apps/a');
+ });
+
+ it('the first product app skips the platform built-ins, hidden and switched-off apps', () => {
+ expect(
+ resolveDesktopLandingPath(
+ [SETUP, STUDIO, { name: 'secret', hidden: true }, { name: 'off', active: false }, { name: 'sales' }],
+ null,
+ ),
+ ).toBe('/apps/sales');
+ });
+
+ it('only built-ins (a fresh environment, objectui#4048): /home, the no-apps empty state', () => {
+ expect(resolveDesktopLandingPath([SETUP, STUDIO], null)).toBe('/home');
+ expect(resolveDesktopLandingPath([{ name: 'setup' }], null)).toBe('/home');
+ expect(resolveDesktopLandingPath([], null)).toBe('/home');
+ expect(resolveDesktopLandingPath(undefined, null)).toBe('/home');
+ });
+
+ it('a last app that is gone, hidden or switched off is ignored', () => {
+ expect(resolveDesktopLandingPath(APPS, 'removed')).toBe('/apps/cloud_control');
+ expect(resolveDesktopLandingPath([{ name: 'secret', hidden: true }, { name: 'a' }], 'secret')).toBe('/apps/a');
+ });
+
+ it('CONTROL — the phone keeps its app list for several apps and no record', () => {
+ expect(resolvePhoneLandingPath([SETUP, { name: 'a' }, { name: 'b' }], null)).toBe('/home');
+ });
+});
diff --git a/ui/apps/console/src/components/RootLandingRedirect.tsx b/ui/apps/console/src/components/RootLandingRedirect.tsx
index 93b6d2d970f..1dbedacb8ce 100644
--- a/ui/apps/console/src/components/RootLandingRedirect.tsx
+++ b/ui/apps/console/src/components/RootLandingRedirect.tsx
@@ -27,13 +27,19 @@
* runs — see {@link isAppListConclusive} (objectui#4233).
*
* NOTE: this gives `isDefault` ROUTING semantics; it was previously a
- * display-only badge. Back-compat: a deployment with no `isDefault` App and ≥2
- * visible Apps still lands on `/home`, exactly as before. (A deploy-time ops
- * override is intentionally kept server-side, not read here — the metadata
- * declaration is the source of truth.)
+ * display-only badge. (A deploy-time ops override is intentionally kept
+ * server-side, not read here — the metadata declaration is the source of
+ * truth.)
+ *
+ * Those three rules are the PHONE's, after its last app
+ * ({@link resolvePhoneLandingPath}). From 768 px up the platform home page is
+ * retired (objectstack#36732): `/` and the old `/home` address both resolve
+ * through {@link resolveDesktopLandingPath} — the last-used app, the declared
+ * default, the first product app — and only a viewer with no product app at
+ * all is left on `/home`, which then draws the no-apps empty state.
*/
-import { useEffect, useRef, useState } from 'react';
+import { useEffect, useRef, useState, type ReactNode } from 'react';
import { useLocation } from 'react-router-dom';
import {
useMetadata,
@@ -41,20 +47,25 @@ import {
RedirectWithSplash,
SETUP_APP_PACKAGE_ID,
SETUP_APP_NAME,
+ isPlatformBuiltinApp,
useLastApp,
+ useLauncherApps,
usePhoneViewport,
+ useServedApps,
} from '@object-ui/app-shell';
import type { MetadataTypeStatus } from '@object-ui/app-shell';
/** Minimal shape this resolver needs off each App metadata record. */
-interface LandingApp {
+// A type alias, not an interface: `useServedApps` takes records indexable by
+// string, which an interface never is.
+type LandingApp = {
name?: string;
isDefault?: boolean;
active?: boolean;
hidden?: boolean;
/** ADR-0048 owning package — the canonical identity of a shipped app. */
_packageId?: string;
-}
+};
/**
* Is this the platform's built-in Setup console (objectui#4048)?
@@ -87,8 +98,10 @@ function landingSegment(apps: readonly LandingApp[], app: LandingApp & { name: s
}
/**
- * The path `/` should redirect to, resolved purely from the App list. Extracted
- * from the component so the policy is unit-testable without a router/render.
+ * The path a phone's `/` redirects to when it knows no last app, resolved
+ * purely from the App list. Extracted from the component so the policy is
+ * unit-testable without a router/render. A desktop resolves through
+ * {@link resolveDesktopLandingPath} instead (objectstack#36732).
*/
export function resolveLandingPath(apps: readonly LandingApp[] | null | undefined): string {
const list = (apps ?? []).filter((a): a is LandingApp & { name: string } => Boolean(a?.name));
@@ -147,27 +160,83 @@ export function resolveLandingPath(apps: readonly LandingApp[] | null | undefine
* The order is the maintainer's ruling (record 7045309332 on #35881, Sales
* 2026-11-20 16:50Z, 「上次用的优先」): the last app beats a declared default,
* which decides only a first sign-in with no last app yet. From 768 px up `/`
- * resolves as before, through {@link resolveLandingPath} alone.
+ * resolves through {@link resolveDesktopLandingPath}.
*/
export function resolvePhoneLandingPath(
apps: readonly LandingApp[] | null | undefined,
lastApp: string | null | undefined,
): string {
+ return lastAppLandingPath(apps, lastApp) ?? resolveLandingPath(apps);
+}
+
+/**
+ * The last app's own address, when `lastApp` still names an active, visible
+ * app of the list; `null` otherwise (no record, or an app since removed,
+ * hidden or switched off).
+ */
+function lastAppLandingPath(
+ apps: readonly LandingApp[] | null | undefined,
+ lastApp: string | null | undefined,
+): string | null {
+ if (!lastApp) return null;
const list = apps ?? [];
- const last = lastApp
- ? list.find(
- (a): a is LandingApp & { name: string } =>
- a?.name === lastApp && a.active !== false && a.hidden !== true,
- )
- : undefined;
- if (last) return `/apps/${landingSegment(list, last)}`;
- return resolveLandingPath(apps);
+ const last = list.find(
+ (a): a is LandingApp & { name: string } =>
+ a?.name === lastApp && a.active !== false && a.hidden !== true,
+ );
+ return last ? `/apps/${landingSegment(list, last)}` : null;
+}
+
+/**
+ * Is this an app somebody put into the environment, rather than one the
+ * platform ships into every deployment (Setup, Studio, Account)? Setup by its
+ * own two-way test (a runtime/DB Setup carries no package id), the rest by the
+ * platform's reserved package namespace (`isPlatformBuiltinApp`, the reading
+ * the first-run checklist's "Put your first app in" row takes).
+ */
+function isProductApp(app: LandingApp): boolean {
+ return !isPlatformSetupApp(app) && !isPlatformBuiltinApp(app);
+}
+
+/**
+ * The path `/` — and the retired `/home` address — redirect to from 768 px up
+ * (objectstack#36732, the maintainer's ruling to retire the platform home
+ * page, 2026-11-23 14:30Z 「同意」).
+ *
+ * 1. the app this person last had open, while it is still an active,
+ * visible app (the order of the #35881 ruling, 「上次用的优先」);
+ * 2. else the App the product declares `isDefault`;
+ * 3. else the first visible PRODUCT app of the list — never a platform
+ * built-in: a viewer whose only apps are Setup or Studio has no product
+ * app yet (objectui#4048);
+ * 4. else `/home`, which on a desktop draws only the no-apps empty state.
+ *
+ * Rule 3 is where a desktop parts from the phone: a phone with several apps
+ * and no record still opens its app list (`resolveLandingPath` rule 3).
+ *
+ * The console chrome asks the same question for its Home affordances
+ * (app-shell's `resolveDesktopHomePath`, read by `useHomePath`), and
+ * `landingHomeParity-7256.test.ts` holds the two answers equal.
+ */
+export function resolveDesktopLandingPath(
+ apps: readonly LandingApp[] | null | undefined,
+ lastApp: string | null | undefined,
+): string {
+ const last = lastAppLandingPath(apps, lastApp);
+ if (last) return last;
+ const list = (apps ?? []).filter((a): a is LandingApp & { name: string } => Boolean(a?.name));
+ const defaultApp = list.find((a) => a.isDefault === true);
+ if (defaultApp) return `/apps/${landingSegment(apps ?? [], defaultApp)}`;
+ const first = list.find((a) => a.active !== false && a.hidden !== true && isProductApp(a));
+ if (first) return `/apps/${landingSegment(apps ?? [], first)}`;
+ return '/home';
}
/**
- * How long a phone's `/` waits for the person's last app to be read before it
- * resolves without it (objectstack#35881). The row rides the console's one
- * preference read, which is normally in by the time the app list is.
+ * How long `/` waits for the person's last app to be read before it resolves
+ * without it (objectstack#35881, and from 768 px up objectstack#36732). The
+ * row rides the console's one preference read, which is normally in by the
+ * time the app list is.
*/
const LAST_APP_WAIT_MS = 2000;
@@ -215,18 +284,35 @@ export function isAppListConclusive(status: MetadataTypeStatus | undefined): boo
*/
const APP_LIST_RETRY_DELAY_MS = 1500;
-export function RootLandingRedirect() {
+export interface RootLandingRedirectProps {
+ /**
+ * What to draw when the landing resolves to `/home` itself. The `/home`
+ * route passes its no-apps page here, so the retired address redirects into
+ * an app whenever there is one and draws the empty state only when there is
+ * none (objectstack#36732). Absent on `/`, which redirects to `/home`.
+ */
+ home?: ReactNode;
+}
+
+export function RootLandingRedirect({ home }: RootLandingRedirectProps = {}) {
const { apps, loading, getTypeStatus, refresh } = useMetadata();
const location = useLocation();
- // objectstack#35881 — a phone lands in the person's last app.
+ // objectstack#35881 — a phone lands in the person's last app, and from
+ // 768 px up so does a desktop (objectstack#36732).
const phone = usePhoneViewport();
+ // objectstack#36732 — a desktop chooses only among the apps the member's
+ // permission sets show (`/me/apps`, the answer every launcher surface reads):
+ // a set-hidden app is never the landing. That answer is held under `/home`
+ // and `/apps/*`, not `/`, so a desktop `/` hands off to `/home` below.
+ const servedApps = useServedApps((apps ?? []) as LandingApp[]);
+ const { pending: servedPending } = useLauncherApps(apps as LandingApp[] | undefined);
const { lastApp, settled: lastAppSettled } = useLastApp();
const [lastAppWaitOver, setLastAppWaitOver] = useState(false);
useEffect(() => {
- if (!phone || lastAppSettled) return;
+ if (lastAppSettled) return;
const id = setTimeout(() => setLastAppWaitOver(true), LAST_APP_WAIT_MS);
return () => clearTimeout(id);
- }, [phone, lastAppSettled]);
+ }, [lastAppSettled]);
// "Not yet" (`loading`) and "asked and failed" (`status === 'error'`) are
// both "no answer" — they differ only in whether waiting will help.
@@ -250,8 +336,14 @@ export function RootLandingRedirect() {
return () => clearTimeout(id);
}, [unresolved, refresh]);
+ // From 768 px up, `/` (a sign-in, the SSO callback) goes to `/home`, the one
+ // desktop resolver, which sits inside the `/me/apps` provider.
+ if (!phone && home === undefined) {
+ return ;
+ }
if (loading || unresolved) return ;
- if (phone && !lastAppSettled && !lastAppWaitOver) return ;
+ if (!lastAppSettled && !lastAppWaitOver) return ;
+ if (!phone && servedPending) return ;
// `RedirectWithSplash`, not a bare `` (objectui#6378). This is the
// widest measured instance of the boot blank: the line above holds the splash
// while the app list loads, and handing off to a null-rendering redirect left
@@ -264,6 +356,7 @@ export function RootLandingRedirect() {
// app root it lands on carries them on to the app's own landing in turn.
const landing = phone
? resolvePhoneLandingPath(apps as LandingApp[] | undefined, lastApp)
- : resolveLandingPath(apps as LandingApp[] | undefined);
- return ;
+ : resolveDesktopLandingPath(servedApps, lastApp);
+ if (home !== undefined && landing === '/home') return <>{home}>;
+ return ;
}
diff --git a/ui/apps/console/src/components/StudioRoute.test.tsx b/ui/apps/console/src/components/StudioRoute.test.tsx
index e4aeba4ea5a..6ae055d22eb 100644
--- a/ui/apps/console/src/components/StudioRoute.test.tsx
+++ b/ui/apps/console/src/components/StudioRoute.test.tsx
@@ -319,36 +319,33 @@ describe('/studio/* — the entry decision, both ways', () => {
it("the refusal's way home leads to the DECLARED landing where there is one (objectui#7373)", async () => {
// The card's case on this gate: a control-plane customer who follows a
// `/studio` link they may not enter. Pre-#7373 the way out defaulted to the
- // `/home` literal, which on that deployment is the environment launcher —
- // "Build an app" / "Start from a template" cards acting on an environment
- // the control plane does not have. This pin fails on that implementation.
- // Since objectui#12035 the way out is the refusal's link, not a redirect.
+ // `/home` literal, which on that deployment was the environment launcher.
+ // Since objectstack#36732 that page is retired from 768 px up: `/home` is
+ // the desktop resolver, which lands in the declared app (pinned in
+ // `RootLandingRedirect.route.test.tsx`). Studio sits outside the `/me/apps`
+ // provider, so the way out names that resolver and never an app it cannot
+ // tell a permission set hides. Since objectui#12035 the way out is the
+ // refusal's link, not a redirect.
renderStudioDeepLink('/studio/hotcrm/data', CONTROL_PLANE_APPS);
- await expectRefusedAt('/studio/hotcrm/data', '/apps/cloud_control');
- await userEvent.click(screen.getByRole('link', { name: WAY_HOME }));
-
- await waitFor(() => expect(pathname()).toBe('/apps/cloud_control'));
- expect(screen.getByTestId('declared-landing')).toBeInTheDocument();
- expect(screen.queryByTestId('home-launcher')).not.toBeInTheDocument();
+ await expectRefusedAt('/studio/hotcrm/data', '/home');
+ expect(screen.queryByTestId('declared-landing')).not.toBeInTheDocument();
// The load-bearing half is unchanged by the retarget: refusing is still
// refusing, and the builder is still never mounted.
expect(designSurface).not.toHaveBeenCalled();
});
- it('keeps the launcher for an environment that declares no landing', async () => {
- // The status quo, as its own case: a real app list WITHOUT a declaration
- // resolves to the launcher, exactly like the no-context cases above.
+ it('objectstack#36732 — on a desktop with no declaration the way home is the /home resolver too', async () => {
+ // A real app list WITHOUT a declaration: the `/home` resolver lands in
+ // its first product app, the place `/` lands, never Setup.
renderStudioDeepLink('/studio/hotcrm/data', [
- { name: 'crm', label: 'CRM' },
{ name: 'setup', label: 'Setup' },
+ { name: 'crm', label: 'CRM' },
]);
await expectRefusedAt('/studio/hotcrm/data', '/home');
await userEvent.click(screen.getByRole('link', { name: WAY_HOME }));
-
await waitFor(() => expect(pathname()).toBe('/home'));
- expect(screen.getByTestId('home-launcher')).toBeInTheDocument();
expect(designSurface).not.toHaveBeenCalled();
});
@@ -387,10 +384,7 @@ describe('/studio/* — the entry decision, both ways', () => {
await waitFor(() => expect(screen.getByTestId('studio-front-door')).toBeInTheDocument());
// The mark is named 「PRODUCT home」 since objectui#12605 (the ruled
// accessible name: product name + home); its target is unchanged.
- expect(screen.getByRole('link', { name: 'ObjectOS home' })).toHaveAttribute(
- 'href',
- '/apps/cloud_control',
- );
+ expect(screen.getByRole('link', { name: 'ObjectOS home' })).toHaveAttribute('href', '/home');
});
it('the package-less scope\'s bare leg lands on its one pillar, the builder mounted (objectui#11553)', async () => {
diff --git a/ui/apps/console/src/components/landingHomeParity-7256.test.ts b/ui/apps/console/src/components/landingHomeParity-7256.test.ts
index a3c113c347d..f978e6ee2f9 100644
--- a/ui/apps/console/src/components/landingHomeParity-7256.test.ts
+++ b/ui/apps/console/src/components/landingHomeParity-7256.test.ts
@@ -30,8 +30,8 @@
* whose "Your apps" tiles are the control plane's own internal management apps.
*/
import { describe, it, expect } from 'vitest';
-import { HOME_LAUNCHER_PATH, resolveDeclaredHomePath } from '@object-ui/app-shell';
-import { resolveLandingPath } from './RootLandingRedirect';
+import { HOME_LAUNCHER_PATH, resolveDeclaredHomePath, resolveDesktopHomePath } from '@object-ui/app-shell';
+import { resolveLandingPath, resolveDesktopLandingPath } from './RootLandingRedirect';
const SETUP = { name: 'setup', _packageId: 'com.objectstack.setup' };
@@ -101,3 +101,50 @@ describe('objectui#7256 — one declaration, one home', () => {
expect(resolveLandingPath(apps)).toBe(HOME_LAUNCHER_PATH);
});
});
+
+// objectstack#36732 — from 768 px up the platform home page is retired, and
+// `/` and the chrome's Home both read the last-used app first. Two readers of
+// one order, held equal across every list above and every kind of record.
+describe('objectstack#36732 — a desktop\'s landing and its Home are one answer', () => {
+ const STUDIO = { name: 'studio', _packageId: 'com.objectstack.studio' };
+ const DESKTOP_LISTS = [
+ ...LISTS,
+ { label: 'Setup and Studio only — a fresh environment for an administrator', apps: [SETUP, STUDIO] },
+ { label: 'built-ins listed first, then products', apps: [SETUP, STUDIO, { name: 'hidden_app', hidden: true }, { name: 'off', active: false }, { name: 'sales' }] },
+ ];
+ const RECORDS = [null, undefined, 'crm', 'ops', 'setup', 'cloud_control', 'removed', 'hidden_app', 'off'];
+
+ it.each(DESKTOP_LISTS)('$label: every record lands both on the same path', ({ apps }) => {
+ for (const lastApp of RECORDS) {
+ expect(resolveDesktopHomePath(apps, lastApp)).toBe(resolveDesktopLandingPath(apps, lastApp));
+ }
+ });
+
+ // A permission set that hides an app (`tabPermissions: hidden`) is applied
+ // ONCE, by app-shell's `useServedApps`, before either reader is called —
+ // `RootLandingRedirect` and `useHomePath` both pass it the same list, and
+ // their own pins (`RootLandingRedirect.route.test.tsx`, `useHomePath.test.tsx`)
+ // hold that wiring. What this matrix holds is the rest: on the narrowed list
+ // the two readers still agree, and the last-used record of the hidden app
+ // never survives on either side.
+ it('a set-hidden last app: both readers skip it on the served list', () => {
+ const declared = [{ name: 'crm' }, { name: 'ops' }, SETUP];
+ const served = declared.filter((a) => a.name !== 'crm'); // crm hidden by a permission set
+ expect(resolveDesktopHomePath(served, 'crm')).toBe('/apps/ops');
+ expect(resolveDesktopLandingPath(served, 'crm')).toBe('/apps/ops');
+ // …and the narrowing is what moved them: unnarrowed, both would open crm.
+ expect(resolveDesktopHomePath(declared, 'crm')).toBe('/apps/crm');
+ expect(resolveDesktopLandingPath(declared, 'crm')).toBe('/apps/crm');
+ });
+
+ it('a set-hidden only product app: both fall back to the no-apps page', () => {
+ const served = [SETUP]; // the one product app is hidden by a permission set
+ expect(resolveDesktopHomePath(served, 'crm')).toBe(HOME_LAUNCHER_PATH);
+ expect(resolveDesktopLandingPath(served, 'crm')).toBe(HOME_LAUNCHER_PATH);
+ });
+
+ it('with no product app both fall back to the no-apps page at /home', () => {
+ expect(resolveDesktopHomePath([SETUP, STUDIO], null)).toBe(HOME_LAUNCHER_PATH);
+ expect(resolveDesktopLandingPath([SETUP, STUDIO], null)).toBe(HOME_LAUNCHER_PATH);
+ });
+});
diff --git a/ui/apps/console/src/pages/settings/FirstRunChecklist.tsx b/ui/apps/console/src/pages/settings/FirstRunChecklist.tsx
index bbe97fe5ac9..0e6773f333e 100644
--- a/ui/apps/console/src/pages/settings/FirstRunChecklist.tsx
+++ b/ui/apps/console/src/pages/settings/FirstRunChecklist.tsx
@@ -10,13 +10,19 @@
*
* ## Where it is drawn
*
- * Home (`/home`), in the slot Home's page gives its host's checklist
- * (app-shell's `HomePage`, `checklist`). Home is the environment's own home
- * (ObjectUI ADR-0075): every deployment that declares no landing app opens
- * there after sign-in, the Setup-only one included (`RootLandingRedirect`).
- * Mounted by the console's Home route (`App.tsx`), inside the
- * `ConsolePermissionsScope` that route already sits under: that provider is
- * what answers which capabilities this session holds.
+ * From 768 px up, at the top of the Setup app's first page (objectstack#36732,
+ * item 5, option A): the desktop's platform home page retired, so an
+ * administrator who has an app lands in it, and Setup's first page is where
+ * the platform is set up. Handed to app-shell's `SetupFirstPageSlotProvider`
+ * by the console's app route (`AppContent.tsx`).
+ *
+ * And Home (`/home`), in the slot Home's page gives its host's checklist
+ * (app-shell's `HomePage`, `checklist`): on a desktop that is the no-apps
+ * empty state, so a new environment's first administrator meets it on the
+ * first screen. Mounted by the console's Home route (`App.tsx`).
+ *
+ * Both mounts sit inside `ConsolePermissionsScope`: that provider is what
+ * answers which capabilities this session holds.
*
* Home names the placement (`placement`). `top`, above the page's sections
* (a desktop, or a page with no app yet), draws the card as it always was.
diff --git a/ui/packages/app-shell/src/chrome/RedirectWithSplash.tsx b/ui/packages/app-shell/src/chrome/RedirectWithSplash.tsx
index c9fc7534d1b..667caa26dcf 100644
--- a/ui/packages/app-shell/src/chrome/RedirectWithSplash.tsx
+++ b/ui/packages/app-shell/src/chrome/RedirectWithSplash.tsx
@@ -61,9 +61,15 @@ export interface RedirectWithSplashProps {
to: string;
/** Replace the current history entry instead of pushing a new one. */
replace?: boolean;
+ /**
+ * Navigation state for the destination, as `` takes it — so
+ * a hop that only re-addresses a visit (`/` → `/home` → the landing app,
+ * objectstack#36732) does not drop what the visit carried.
+ */
+ state?: unknown;
}
-export function RedirectWithSplash({ to, replace }: RedirectWithSplashProps) {
+export function RedirectWithSplash({ to, replace, state }: RedirectWithSplashProps) {
return (
<>
{/* Order is not load-bearing — `` renders null — but the
@@ -72,7 +78,7 @@ export function RedirectWithSplash({ to, replace }: RedirectWithSplashProps) {
fallback, so on an app route after the session read it is the
console's frame those gates were showing, and the splash elsewhere. */}
-
+
>
);
}
diff --git a/ui/packages/app-shell/src/console/AppContent.tsx b/ui/packages/app-shell/src/console/AppContent.tsx
index 234ce8fe1d7..27c6c14a3cc 100644
--- a/ui/packages/app-shell/src/console/AppContent.tsx
+++ b/ui/packages/app-shell/src/console/AppContent.tsx
@@ -67,6 +67,8 @@ import {
navEntriesShownOncePendingReadsShow,
} from '../hooks/useNavMemberGates.js';
import { resolveSetupAppPath } from './ConsoleShell.js';
+import { isLandingPath, useSetupFirstPageSlot } from './setupFirstPageSlot.js';
+import { useInSetupApp } from './setupApp.js';
import { useSetupAliasApprovalsTarget } from './setupAliasApprovals.js';
import { APP_ROUTE_METADATA_READS, collectRoutePaths, metadataReadsForAppRoute } from './appRouteMetadataReads.js';
import { enterAppBundle, objectViewRouteObject, prefetchObjectViewRows, readAppObjectScope } from './appObjectScope.js';
@@ -1626,6 +1628,7 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps =
// view, with the sentence that says so.
) : (
+ } />
+
)}
{/* objectstack#32685 — after the route's element in the same
boundary: shown in the commit that shows the route, never
@@ -1967,6 +1971,55 @@ function carryQueryOntoLanding(target: string, search: string, hash: string): st
return `${beforeHash.slice(0, queryAt)}?${params.toString()}${carriedHash}`;
}
+/**
+ * The route an app's root lands on for this member: `resolveLandingRoute` over
+ * the trees the member is shown, as `AppRootLanding` asks it once the reads
+ * are decided.
+ */
+function memberLandingRoute(app: any, gates: ReturnType, ctx: NavTemplateContext): string {
+ const areas = (app?.areas || []) as Array<{ navigation?: NavigationItem[] } | null | undefined>;
+ const trees = [
+ navEntriesShownToMember(app?.navigation || [], gates),
+ ...areas.map((area) => navEntriesShownToMember(area?.navigation || [], gates)),
+ ];
+ return resolveLandingRoute(app, trees, gates.evaluateVisibility, ctx);
+}
+
+/**
+ * objectstack#36732 (item 5, option A) — the host's element above the Setup
+ * app's first page (`setupFirstPageSlot.ts`): the page Setup's root lands on
+ * for this member, asked the way `AppRootLanding` asks it, over the trees the
+ * member is shown. Drawn from 768 px up only (a phone is unchanged), and only
+ * in Setup. Where it is drawn, the page scrolls as one
+ * column: the element first, the route's page at its full height below it.
+ */
+function SetupFirstPageTop({
+ app,
+ ctx,
+ children,
+}: {
+ app: any;
+ ctx: NavTemplateContext;
+ children: ReactNode;
+}) {
+ const slot = useSetupFirstPageSlot();
+ const inSetup = useInSetupApp();
+ const phone = usePhoneViewport();
+ const gates = useNavMemberGates();
+ const location = useLocation();
+ // The path below `/apps/SEGMENT/`, the base every landing route is relative to.
+ const inAppPath = location.pathname.split('/').slice(3).join('/');
+ const onFirstPage = Boolean(slot) && inSetup && !phone && isLandingPath(inAppPath, memberLandingRoute(app, gates, ctx));
+ // The same two wrappers on every route, the slot's place held by `null`
+ // elsewhere, so moving onto or off the first page never remounts the routes.
+ return (
+
+ {onFirstPage && slot ?
{slot()}
: null}
+
{children}
+
+ );
+}
+
/**
* The app root (`/apps/:appName`): navigates to the app's landing, or says the
* member has nothing here.
diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.deniedVsUnpublished.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.deniedVsUnpublished.test.tsx
index 51ea0bf0af4..669dde94e46 100644
--- a/ui/packages/app-shell/src/console/__tests__/AppContent.deniedVsUnpublished.test.tsx
+++ b/ui/packages/app-shell/src/console/__tests__/AppContent.deniedVsUnpublished.test.tsx
@@ -254,6 +254,18 @@ vi.mock('../../providers/MetadataProvider', async (importOriginal) => ({
}),
}));
+// The console's preview and authoring code loads `@objectstack/lint` lazily;
+// warmed here so its first load is paid at import, not inside a test's clock.
+// objectstack#36732 — on `/apps/*` the console's chrome sits under
+// `LauncherAppsProvider`, whose `/me/apps` answer is held once the first read
+// lands; this host mounts none, so the held answer is stated here. Without one
+// a desktop's Home names `/home` (pinned in `useHomePath.servedAnswer-36732`).
+vi.mock('../../hooks/useLauncherApps', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useServedAppsSettled: () => true,
+}));
+
+import '@objectstack/lint';
import { AppContent } from '../AppContent';
function LocationProbe() {
@@ -537,16 +549,17 @@ describe('AppContent — every screen here states what the probe measured (objec
).toEqual([]);
});
- it('the denial screen offers a way back to /home', async () => {
+ it('the denial screen offers a way back home: the first product app on a desktop (objectstack#36732)', async () => {
// Nothing declared in `metadataApps` here (the `beforeEach` list is a plain
- // `crm`), so home IS the launcher — the status quo objectui#7373 kept.
+ // `crm`) and no last app, so home is the first product app: the platform
+ // home page is retired from 768 px up.
byName.finance = () => json(403, DENIED_BODY);
renderConsoleAt('/apps/finance');
const home = await screen.findByTestId('app-access-denied-home');
home.click();
- await waitFor(() => expect(screen.getByTestId('pathname').textContent).toBe('/home'));
+ await waitFor(() => expect(screen.getByTestId('pathname').textContent).toBe('/apps/crm'));
});
it('…and that way back follows the DECLARED landing where there is one (objectui#7373)', async () => {
@@ -603,8 +616,8 @@ describe('AppContent — every screen here states what the probe measured (objec
expect(screen.getByTestId(`${testId}-retry`)).toBeInTheDocument();
home.click();
- await waitFor(() => expect(screen.getByTestId('pathname').textContent).toBe('/home'));
- expect(screen.getByTestId('home-launcher')).toBeInTheDocument();
+ // objectstack#36732 — home on a desktop is the first product app.
+ await waitFor(() => expect(screen.getByTestId('pathname').textContent).toBe('/apps/crm'));
});
// Independent of the way home on purpose: dropping that button leaves these
diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.inaccessibleAppStrand.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.inaccessibleAppStrand.test.tsx
index 6e5ee98766f..d020dc0c896 100644
--- a/ui/packages/app-shell/src/console/__tests__/AppContent.inaccessibleAppStrand.test.tsx
+++ b/ui/packages/app-shell/src/console/__tests__/AppContent.inaccessibleAppStrand.test.tsx
@@ -152,6 +152,18 @@ vi.mock('@object-ui/react', async (importOriginal) => ({
useMutationInvalidationBridge: () => {},
}));
+// objectstack#36732 — on `/apps/*` the console's chrome sits under
+// `LauncherAppsProvider`, whose `/me/apps` answer is held once the first read
+// lands; this host mounts none, so the held answer is stated here. Without one
+// a desktop's Home names `/home` (pinned in `useHomePath.servedAnswer-36732`).
+vi.mock('../../hooks/useLauncherApps', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useServedAppsSettled: () => true,
+}));
+
+// The page reaches a dynamic `@objectstack/lint` import; its first load is paid
+// here, at collection, never inside a case's clock (`check:test-source-alias`).
+import '@objectstack/lint';
import { AppContent } from '../AppContent';
/**
diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.setupFirstPage-36732.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.setupFirstPage-36732.test.tsx
new file mode 100644
index 00000000000..e78d1ccf1b4
--- /dev/null
+++ b/ui/packages/app-shell/src/console/__tests__/AppContent.setupFirstPage-36732.test.tsx
@@ -0,0 +1,273 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * objectstack#36732, item 5 (option A, the maintainer's pick): the host's
+ * first-run checklist sits at the top of the Setup app's FIRST page, from
+ * 768 px up, now that the desktop's platform home page retired.
+ *
+ * "First page" is the page Setup's root lands on for this member, asked the
+ * way the root asks it, so the slot follows Setup's navigation instead of a
+ * spelled route. These cases drive the real `AppContent` over a served Setup
+ * app whose first entry is `sys_user` and whose second is `sys_team`:
+ * - the root lands on `sys_user` and the slot is drawn above it;
+ * - Setup's other pages, another app's same route, a phone, and a host that
+ * provides no slot draw none.
+ * Who sees the checklist and when it hides are the checklist's own rules,
+ * pinned in the console's FirstRunChecklist tests.
+ */
+
+import '@testing-library/jest-dom/vitest';
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
+// The page reaches a dynamic `@objectstack/lint` import; its first load is paid
+// here, at collection, never inside a case's clock (`check:test-source-alias`).
+import '@objectstack/lint';
+import React from 'react';
+import { render, screen, act } from '@testing-library/react';
+import { MemoryRouter, Routes, Route, useLocation, useNavigate, type NavigateFunction } from 'react-router-dom';
+import { MePermissionsProvider, type MePermissionsResponse } from '@object-ui/permissions';
+import { SchemaRendererContext } from '@object-ui/react';
+
+// AGENTS.md §测试纪律 — the lazy page modules are stubbed so no unbounded
+// `import()` races a bounded `findBy` window.
+vi.mock('../../views/metadata-admin', () => ({
+ MetadataDirectoryPage: () => ,
+ MetadataResourceListPage: () => ,
+ MetadataResourceEditPage: () => ,
+ MetadataResourceHistoryPage: () => ,
+ MetadataDiagnosticsPage: () => ,
+}));
+
+vi.mock('@object-ui/plugin-designer', async (importOriginal) => ({
+ ...(await importOriginal()),
+ CreateAppPage: () => ,
+ EditAppPage: () => ,
+ DashboardDesignPage: () => ,
+}));
+
+vi.mock('../../layout/ConsoleLayout', () => ({
+ ConsoleLayout: ({ activeAppName, children }: { activeAppName?: string; children?: React.ReactNode }) => (
+
}>{routes}
+ ) : (
+ routes
+ )}
+
+ ,
+ );
+}
+
+const pathname = () => screen.getByTestId('pathname').textContent;
+const entry = (id: string, objectName: string) => ({ id, type: 'object', objectName, label: objectName });
+
+const SETUP = {
+ name: 'setup',
+ label: 'Setup',
+ _packageId: 'com.objectstack.setup',
+ navigation: [entry('nav_users', 'sys_user'), entry('nav_teams', 'sys_team')],
+};
+const CRM = {
+ name: 'crm',
+ label: 'CRM',
+ _packageId: 'com.acme.crm',
+ navigation: [entry('nav_users', 'sys_user')],
+};
+
+let restoreWidth: (() => void) | null = null;
+function atWidth(width: number) {
+ const before = window.innerWidth;
+ Object.defineProperty(window, 'innerWidth', { configurable: true, writable: true, value: width });
+ window.dispatchEvent(new Event('resize'));
+ restoreWidth = () => {
+ Object.defineProperty(window, 'innerWidth', { configurable: true, writable: true, value: before });
+ window.dispatchEvent(new Event('resize'));
+ };
+}
+
+describe('objectstack#36732 — the checklist sits on the Setup app\'s first page', () => {
+ beforeEach(() => {
+ metadataApps = [SETUP, CRM];
+ atWidth(1280);
+ });
+ afterEach(() => {
+ restoreWidth?.();
+ restoreWidth = null;
+ });
+
+ it('draws the host\'s element above the page Setup\'s root lands on', async () => {
+ renderConsoleAt('/apps/com.objectstack.setup');
+ expect(await screen.findByTestId('object-view')).toBeInTheDocument();
+ expect(pathname()).toBe('/apps/com.objectstack.setup/sys_user');
+ const top = screen.getByTestId('setup-first-page');
+ expect(top).toContainElement(screen.getByTestId('host-checklist'));
+ // Above the page, in the one scrolling column.
+ expect(top.compareDocumentPosition(screen.getByTestId('object-view')) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ });
+
+ it('moving off the first page keeps the routes mounted: only the slot goes', async () => {
+ renderConsoleAt('/apps/com.objectstack.setup/sys_user');
+ const page = await screen.findByTestId('object-view');
+ expect(screen.getByTestId('host-checklist')).toBeInTheDocument();
+ act(() => navigator.current!('/apps/com.objectstack.setup/sys_team'));
+ expect(pathname()).toBe('/apps/com.objectstack.setup/sys_team');
+ expect(screen.queryByTestId('host-checklist')).not.toBeInTheDocument();
+ // The same element: the route below the slot was not unmounted and mounted again.
+ expect(screen.getByTestId('object-view')).toBe(page);
+ });
+
+ it('draws it on a direct visit to that page too', async () => {
+ renderConsoleAt('/apps/com.objectstack.setup/sys_user?palette=1');
+ expect(await screen.findByTestId('object-view')).toBeInTheDocument();
+ expect(screen.getByTestId('host-checklist')).toBeInTheDocument();
+ });
+
+ it('draws nothing on Setup\'s other pages', async () => {
+ renderConsoleAt('/apps/com.objectstack.setup/sys_team');
+ expect(await screen.findByTestId('object-view')).toBeInTheDocument();
+ expect(screen.queryByTestId('host-checklist')).not.toBeInTheDocument();
+ expect(screen.queryByTestId('setup-first-page')).not.toBeInTheDocument();
+ });
+
+ it('draws nothing on another app\'s first page', async () => {
+ renderConsoleAt('/apps/com.acme.crm/sys_user');
+ expect(await screen.findByTestId('object-view')).toBeInTheDocument();
+ expect(screen.queryByTestId('host-checklist')).not.toBeInTheDocument();
+ });
+
+ it('draws nothing on a phone, which is unchanged', async () => {
+ restoreWidth?.();
+ atWidth(375);
+ renderConsoleAt('/apps/com.objectstack.setup/sys_user');
+ expect(await screen.findByTestId('object-view')).toBeInTheDocument();
+ expect(screen.queryByTestId('host-checklist')).not.toBeInTheDocument();
+ });
+
+ it('draws nothing where the host provides no element', async () => {
+ renderConsoleAt('/apps/com.objectstack.setup/sys_user', false);
+ expect(await screen.findByTestId('object-view')).toBeInTheDocument();
+ expect(screen.queryByTestId('setup-first-page')).not.toBeInTheDocument();
+ });
+});
+
+describe('isLandingPath', () => {
+ it('compares paths without the query, hash or edge slashes', () => {
+ expect(isLandingPath('dashboard/system_overview', 'dashboard/system_overview')).toBe(true);
+ expect(isLandingPath('/dashboard/system_overview/', 'dashboard/system_overview?range=7d')).toBe(true);
+ expect(isLandingPath('dashboard/other', 'dashboard/system_overview')).toBe(false);
+ expect(isLandingPath('', '')).toBe(false);
+ });
+});
diff --git a/ui/packages/app-shell/src/console/__tests__/RequireAiSurface.test.tsx b/ui/packages/app-shell/src/console/__tests__/RequireAiSurface.test.tsx
index 7f8f60db862..c660e36c8a8 100644
--- a/ui/packages/app-shell/src/console/__tests__/RequireAiSurface.test.tsx
+++ b/ui/packages/app-shell/src/console/__tests__/RequireAiSurface.test.tsx
@@ -18,7 +18,7 @@ const mockSurface = vi.mocked(useAiSurfaceEnabled);
* Who is looking, and whether this runtime offers authoring: the three terms
* the no-assistant screen offers Studio's new-package flow on.
*/
-const viewer = vi.hoisted(() => ({ isAdmin: true, canAuthorMetadata: true, aiStudio: true }));
+const viewer = vi.hoisted(() => ({ isAdmin: true, canAuthorMetadata: true, aiStudio: true, phone: false }));
vi.mock('@object-ui/auth', async (importOriginal) => ({
...(await importOriginal>()),
useWorkspaceAdminStatus: () => ({ isAdmin: viewer.isAdmin, isResolved: true }),
@@ -27,6 +27,13 @@ vi.mock('../../hooks/useCanAuthorMetadata', async (importOriginal) => ({
...(await importOriginal>()),
useCanAuthorMetadata: () => viewer.canAuthorMetadata,
}));
+// objectstack#36732 — the width decides the Home target: a phone goes to the
+// declared landing directly; a desktop, here outside the `/me/apps` provider,
+// names `/home`, whose desktop route resolves the same landing.
+vi.mock('../../hooks/usePhoneViewport', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ usePhoneViewport: () => viewer.phone,
+}));
vi.mock('../../runtime-config', async (importOriginal) => ({
...(await importOriginal>()),
isAiStudioEnabled: () => viewer.aiStudio,
@@ -86,6 +93,7 @@ describe('RequireAiSurface', () => {
viewer.isAdmin = true;
viewer.canAuthorMetadata = true;
viewer.aiStudio = true;
+ viewer.phone = false;
});
it('renders the AI surface when the server serves agents (cloud install)', () => {
@@ -141,6 +149,8 @@ describe('RequireAiSurface', () => {
// control plane that serves no agent. Pre-#7373 the default was the `/home`
// literal, so the customer landed among environment cards that cannot act
// on anything their deployment has. This pin fails on that implementation.
+ // On a phone, which still has its own Home page (#36732).
+ viewer.phone = true;
const user = userEvent.setup();
mockSurface.mockReturnValue({ enabled: false, isLoading: false });
renderGuardedAi([
@@ -152,11 +162,28 @@ describe('RequireAiSurface', () => {
expect(screen.queryByText('HOME')).not.toBeInTheDocument();
});
+ it('on a desktop, outside the /me/apps provider, leads to /home — the route that resolves the declared landing (objectstack#36732)', async () => {
+ // `/ai/*` is not under `LauncherAppsProvider`, so the guard cannot tell
+ // whether a permission set hides the declared app. It names `/home`, which
+ // on a desktop is no longer the launcher page but the resolver that lands
+ // in the declared app once it knows.
+ const user = userEvent.setup();
+ mockSurface.mockReturnValue({ enabled: false, isLoading: false });
+ renderGuardedAi([
+ { name: 'cloud_control', label: 'Cloud', isDefault: true },
+ { name: 'account', label: 'Account' },
+ ]);
+ await user.click(screen.getByTestId('ai-unavailable-home'));
+ expect(screen.getByText('HOME')).toBeInTheDocument();
+ });
+
it('keeps the launcher for an ordinary environment that declares nothing', async () => {
// The status quo, stated as its own case so the two answers cannot be
- // confused for one: an app list WITHOUT a declaration still resolves to the
- // launcher, and so does a guard mounted outside a metadata provider (every
- // other case in this file).
+ // confused for one: an app list WITHOUT a declaration resolves to the
+ // launcher. `/ai/*` sits outside the `/me/apps` provider, so on a desktop
+ // Home names `/home`, the route that resolves the last-used / first app
+ // once it knows which apps a permission set hides (#36732); a guard mounted
+ // outside a metadata provider resolves there too (every other case here).
const user = userEvent.setup();
mockSurface.mockReturnValue({ enabled: false, isLoading: false });
renderGuardedAi([{ name: 'crm', label: 'CRM' }, { name: 'setup', label: 'Setup' }]);
diff --git a/ui/packages/app-shell/src/console/ai/__tests__/AiAddressRedirect-34608.test.tsx b/ui/packages/app-shell/src/console/ai/__tests__/AiAddressRedirect-34608.test.tsx
index fd8181f82a1..5bb33e55deb 100644
--- a/ui/packages/app-shell/src/console/ai/__tests__/AiAddressRedirect-34608.test.tsx
+++ b/ui/packages/app-shell/src/console/ai/__tests__/AiAddressRedirect-34608.test.tsx
@@ -15,11 +15,16 @@ import React from 'react';
import { cleanup, render, screen } from '@testing-library/react';
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
-const meta = vi.hoisted(() => ({ apps: [] as Array> }));
+const meta = vi.hoisted(() => ({ apps: [] as Array>, phone: false }));
vi.mock('../../../providers/MetadataProvider', async (importOriginal) => ({
...(await importOriginal>()),
useMetadata: () => ({ apps: meta.apps }),
}));
+// objectstack#36732 — the width decides where home is named from.
+vi.mock('../../../hooks/usePhoneViewport', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ usePhoneViewport: () => meta.phone,
+}));
import { AiAddressRedirect } from '../AiAddressRedirect';
import { DOCK_EXPANDED_STORAGE_KEY } from '../../../layout/chatDockState';
@@ -50,6 +55,7 @@ function visit(entry: string | { pathname: string; search?: string; state?: unkn
afterEach(() => {
cleanup();
meta.apps = [];
+ meta.phone = false;
window.sessionStorage.clear();
});
@@ -76,13 +82,23 @@ describe('an old /ai address opens the drawer on what it named (objectstack#3460
expect(readStoredDockTarget()).toBeUndefined();
});
- it('lands on the declared home when the deployment declares one', async () => {
+ it('lands on the declared home when the deployment declares one (a phone)', async () => {
+ meta.phone = true;
meta.apps = [{ name: 'crm', isDefault: true, active: true }];
visit('/ai/ask');
const landing = await screen.findByTestId('landing');
expect(landing).toHaveTextContent(/^\/apps\/crm$/);
});
+ it('on a desktop lands on /home, which resolves the app once it knows which apps a set hides (objectstack#36732)', async () => {
+ // `/ai/*` is outside the `/me/apps` provider; the desktop `/home` route is
+ // the resolver, and it carries this visit's navigation state on.
+ meta.apps = [{ name: 'crm', isDefault: true, active: true }];
+ visit('/ai/ask');
+ const landing = await screen.findByTestId('landing');
+ expect(landing).toHaveTextContent(/^\/home$/);
+ });
+
it('a Builder handoff rides navigation state to the landing, never storage (objectui#12493)', async () => {
visit({ pathname: '/ai/build', state: { handoffPrompt: 'Build a CRM', parentConversationId: 'ask-1' } });
const landing = await screen.findByTestId('landing');
diff --git a/ui/packages/app-shell/src/console/home/HomePage.tsx b/ui/packages/app-shell/src/console/home/HomePage.tsx
index 174a3e01213..53296667f15 100644
--- a/ui/packages/app-shell/src/console/home/HomePage.tsx
+++ b/ui/packages/app-shell/src/console/home/HomePage.tsx
@@ -18,11 +18,17 @@
* With no app yet it is drawn above the empty state at every width, and while
* the page is loading it is not drawn, so it mounts once, where it stays.
*
+ * From 768 px up the page is retired (objectstack#36732): the host redirects
+ * `/home` into an app whenever the viewer has a product app, so a desktop
+ * reaches this page only with none, and draws the no-apps empty state
+ * ({@link DesktopNoApps}): build with AI, start from a template, the app
+ * marketplace, for the viewers who may add an app.
+ *
* @module
*/
import { useEffect, useId, useMemo, useRef, useState } from 'react';
-import { useNavigate } from 'react-router-dom';
+import { Link, useNavigate } from 'react-router-dom';
import { useMetadata } from '../../providers/MetadataProvider.js';
import { useRecentItems, type RecentItem } from '../../hooks/useRecentItems.js';
import { useRecentItemLabel } from '../../hooks/useRecentItemLabel.js';
@@ -84,6 +90,8 @@ import { resolveAiApiBase } from '../../hooks/useAiSurface.js';
import { isAiStudioEnabled, isMarketplaceEnabled } from '../../runtime-config.js';
import { STUDIO_NEW_PACKAGE_PATH } from '../../views/studio-design/studioNewPackage.js';
import { useOpenAssistant } from '../../layout/chatDockControl.js';
+import { isProductApp } from '../../utils/homePath.js';
+import { useAddAppEntries, useMayAddApp } from '../../hooks/useAddAppEntries.js';
/**
* Which AI home CTAs to surface, driven by the live agent catalog (the single
@@ -201,6 +209,73 @@ function BuilderChip({
);
}
+/**
+ * The desktop's no-apps empty state (objectstack#36732; design board 45,
+ * picture 4): what is left of the retired platform home page. A viewer who may
+ * add an app (`useMayAddApp`, the sidebar app menu's own gate) is offered its
+ * 「Add app」 doors as buttons, the first one primary; an administrator
+ * without `manage_metadata` is told why there are none (objectstack#8270);
+ * anyone else is told their administrator shares apps with them.
+ */
+function DesktopNoApps({
+ showAuthoringGate,
+ authoringGateReason,
+ t,
+}: {
+ showAuthoringGate: boolean;
+ authoringGateReason: string;
+ t: (key: string, opts?: any) => string;
+}) {
+ const mayAddApp = useMayAddApp();
+ return (
+
+ {t('home.noAppsTitle', { defaultValue: 'No applications yet' })}
+ {mayAddApp ? (
+
+ {t('home.noAppsAddDescription', {
+ defaultValue: 'Build your first app, or start from a template or the app marketplace.',
+ })}
+
+ ) : showAuthoringGate ? (
+ {authoringGateReason}
+ ) : (
+
+ {t('home.noAppsDescription', {
+ defaultValue: 'The system is being set up — apps your admin shares with you will show up here.',
+ })}
+
+ )}
+ {mayAddApp && }
+
+ );
+}
+
+/**
+ * The 「Add app」 doors as the empty state's buttons. Its own component so
+ * only a viewer who may add an app pays the agent-catalog read the list makes.
+ */
+function NoAppsAddActions() {
+ const entries = useAddAppEntries();
+ if (entries.length === 0) return null;
+ return (
+
+ {entries.map((entry, index) => (
+
+ ))}
+
+ );
+}
+
/**
* Home AI call-to-action(s). "Build with AI" only when a build agent is
* deployed AND the session may author metadata; "Ask AI" only when a
@@ -673,7 +748,13 @@ export function HomePage({ checklist }: HomePageProps = {}) {
);
}
- if (activeApps.length === 0) {
+ // objectstack#36732 — a desktop with no product app (none at all, or only
+ // the platform's own Setup and Studio) draws the no-apps empty state.
+ // The launcher's list (`/me/apps`): an app a permission set hides is not one
+ // of the viewer's, as the landing that sent them here reads it.
+ const desktopNoApps = !phone && !launcher.apps.some(isProductApp);
+
+ if (activeApps.length === 0 || desktopNoApps) {
return (
{/* With no app yet, the drafts row is the whole of "My work": the
@@ -704,7 +785,13 @@ export function HomePage({ checklist }: HomePageProps = {}) {
builder CTAs, so they get the reason instead of the instruction. AI
"Ask" stays offered — it reads data and needs no authoring capability.
*/}
- {isAdmin && !canAuthorMetadata ? (
+ {desktopNoApps ? (
+
+ ) : isAdmin && !canAuthorMetadata ? (
{t('home.noAppsTitle', { defaultValue: 'No applications yet' })}
diff --git a/ui/packages/app-shell/src/console/home/__tests__/ConnectAssistantCard.homePlacement-35017.test.tsx b/ui/packages/app-shell/src/console/home/__tests__/ConnectAssistantCard.homePlacement-35017.test.tsx
index eb5dc58c749..8d0af0a60d5 100644
--- a/ui/packages/app-shell/src/console/home/__tests__/ConnectAssistantCard.homePlacement-35017.test.tsx
+++ b/ui/packages/app-shell/src/console/home/__tests__/ConnectAssistantCard.homePlacement-35017.test.tsx
@@ -158,7 +158,25 @@ describe('with apps: greeting, My apps, My work, then the card (objectstack#3501
});
});
+
+/**
+ * objectstack#36732 — from 768 px up a viewer with no product app is drawn the
+ * no-apps empty state (`HomePage.desktopNoApps-36732.test.tsx`); the empty
+ * state these cases read is a phone's, so they render at phone width.
+ */
+function atPhoneWidth() {
+ const real = window.innerWidth;
+ Object.defineProperty(window, 'innerWidth', { value: 375, configurable: true, writable: true });
+ return () => Object.defineProperty(window, 'innerWidth', { value: real, configurable: true, writable: true });
+}
+
describe('with no app yet: after the welcome (objectstack#35017)', () => {
+ let restoreWidth = () => {};
+ beforeEach(() => {
+ restoreWidth = atPhoneWidth();
+ });
+ afterEach(() => restoreWidth());
+
it('draws the card after the empty state, not above it', () => {
state.apps = [];
render();
diff --git a/ui/packages/app-shell/src/console/home/__tests__/HomePage.authoringCapabilityGate.test.tsx b/ui/packages/app-shell/src/console/home/__tests__/HomePage.authoringCapabilityGate.test.tsx
index d2e88b3bc6c..0f39d2c14cd 100644
--- a/ui/packages/app-shell/src/console/home/__tests__/HomePage.authoringCapabilityGate.test.tsx
+++ b/ui/packages/app-shell/src/console/home/__tests__/HomePage.authoringCapabilityGate.test.tsx
@@ -255,6 +255,18 @@ function renderHome(permissions: MePermissionsResponse) {
);
}
+
+/**
+ * objectstack#36732 — from 768 px up a viewer with no product app is drawn the
+ * no-apps empty state (`HomePage.desktopNoApps-36732.test.tsx`); the empty
+ * state these cases read is a phone's, so they render at phone width.
+ */
+function atPhoneWidth() {
+ const real = window.innerWidth;
+ Object.defineProperty(window, 'innerWidth', { value: 375, configurable: true, writable: true });
+ return () => Object.defineProperty(window, 'innerWidth', { value: real, configurable: true, writable: true });
+}
+
describe('HomePage authoring-CTA capability gate (objectstack#8270)', () => {
beforeEach(() => {
navigateMock.mockReset();
@@ -357,9 +369,12 @@ describe('HomePage authoring-CTA capability gate (objectstack#8270)', () => {
});
describe('the zero-app workspace', () => {
+ let restoreWidth = () => {};
beforeEach(() => {
appsFixture = [];
+ restoreWidth = atPhoneWidth();
});
+ afterEach(() => restoreWidth());
it('explains the posture instead of telling the owner to build something', () => {
// This branch renders before the builder cover exists, and its admin copy
diff --git a/ui/packages/app-shell/src/console/home/__tests__/HomePage.desktopNoApps-36732.test.tsx b/ui/packages/app-shell/src/console/home/__tests__/HomePage.desktopNoApps-36732.test.tsx
new file mode 100644
index 00000000000..fbcf54d13cc
--- /dev/null
+++ b/ui/packages/app-shell/src/console/home/__tests__/HomePage.desktopNoApps-36732.test.tsx
@@ -0,0 +1,160 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * objectstack#36732 — the desktop's no-apps empty state, what is left of the
+ * retired platform home page. From 768 px up a viewer with no product app (no
+ * app but Setup and the platform's own) is drawn 「No applications yet」, and a
+ * viewer who may add an app is offered the sidebar's 「Add app」 doors (build
+ * with AI, start from a template, the marketplace) as buttons. An administrator
+ * without `manage_metadata` is told why there are none (objectstack#8270);
+ * anyone else is told their administrator shares apps with them.
+ *
+ * `t` echoes the KEY, so an assertion on «home.noAppsAddDescription» fails if
+ * the copy is ever hardcoded. happy-dom's window is 1024 px wide: the desktop.
+ */
+
+import '@testing-library/jest-dom/vitest';
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
+import React from 'react';
+import { render, screen, cleanup } from '@testing-library/react';
+
+vi.mock('react-router-dom', async () => {
+ const { createElement } = await import('react');
+ return {
+ useNavigate: () => vi.fn(),
+ Link: ({ to, ...rest }: { to: string } & Record) =>
+ createElement('a', { ...rest, href: to }),
+ };
+});
+
+vi.mock('@object-ui/i18n', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useObjectTranslation: () => ({ t: (key: string) => `«${key}»`, language: 'en' }),
+ useObjectLabel: () => ({ appLabel: (app: any) => String(app?.label ?? app?.name ?? '') }),
+}));
+
+const viewer = { isAdmin: true, canAuthor: true, aiEnabled: true };
+
+vi.mock('@object-ui/auth', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useAuth: () => ({ user: { id: 'u1', name: 'Zhang San', email: 'zhangsan@acme-test.com' } }),
+ useWorkspaceAdminStatus: () => ({ isAdmin: viewer.isAdmin, isResolved: true }),
+}));
+
+vi.mock('../../../hooks/useCanAuthorMetadata', () => ({
+ useCanAuthorMetadata: () => viewer.canAuthor,
+ useCanReadPendingDrafts: () => false,
+}));
+
+vi.mock('@object-ui/plugin-chatbot/core', async (importOriginal) => ({
+ ...(await importOriginal()),
+ useAgents: () => ({ agents: [{ name: 'builder' }] }),
+ isAskAgent: () => false,
+ agentHasCapability: () => true,
+}));
+
+let appsFixture: any[] = [];
+vi.mock('../../../providers/MetadataProvider', () => ({
+ useMetadata: () => ({ apps: appsFixture, loading: false }),
+}));
+vi.mock('../../../context/NavigationContext', () => ({
+ useNavigationContext: () => ({ currentAppName: undefined }),
+}));
+vi.mock('../../../hooks/useRecentItems', () => ({ useRecentItems: () => ({ recentItems: [] }) }));
+vi.mock('../../../hooks/useFavorites', () => ({ useFavorites: () => ({ favorites: [] }) }));
+vi.mock('../../../hooks/useHomeInbox', () => ({
+ useHomeInbox: () => ({
+ pendingApprovalsCount: 0,
+ pendingApprovals: [],
+ pendingApprovalsReadable: true,
+ notificationsReadable: true,
+ notifications: [],
+ unreadTopicCount: 0,
+ activity: { value: [], status: 'ready', readable: true },
+ }),
+}));
+vi.mock('../../../hooks/useAiSurface', () => ({
+ resolveAiApiBase: () => '',
+ useAiSurfaceEnabled: () => ({ enabled: viewer.aiEnabled, loading: false }),
+}));
+vi.mock('../../../views/metadata-admin/useMetadata', () => ({
+ useMetadataClient: () => ({ listDrafts: async () => [] }),
+}));
+vi.mock('../../../preview/usePublishAllDrafts', () => ({
+ usePublishAllDrafts: () => ({ publishAll: async () => ({ ok: true }), publishing: false }),
+}));
+vi.mock('../../../runtime-config', () => ({
+ getRuntimeConfig: () => ({ branding: { productName: 'ObjectStack' } }),
+ isMarketplaceEnabled: () => true,
+ isAiStudioEnabled: () => true,
+}));
+vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
+vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
+vi.mock('../ConnectAssistantCard', () => ({ ConnectAssistantCard: () => null }));
+
+// The console's preview code loads `@objectstack/lint` lazily; paid at import,
+// not inside a test's clock.
+import '@objectstack/lint';
+import { HomePage } from '../HomePage';
+
+const SETUP = { name: 'setup', label: 'Setup', _packageId: 'com.objectstack.setup' };
+const STUDIO = { name: 'studio', label: 'Studio', _packageId: 'com.objectstack.studio' };
+
+beforeEach(() => {
+ viewer.isAdmin = true;
+ viewer.canAuthor = true;
+ viewer.aiEnabled = true;
+ appsFixture = [SETUP, STUDIO];
+ vi.stubGlobal('fetch', vi.fn(async () => ({ ok: true, status: 200, json: async () => ({ drafts: [] }) })));
+});
+
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+});
+
+describe('HomePage — the desktop no-apps empty state (objectstack#36732)', () => {
+ it('offers an admin who may author the 「Add app」 doors, building with AI first', () => {
+ render();
+ const empty = screen.getByTestId('home-no-apps');
+ expect(empty).toHaveTextContent('«home.noAppsTitle»');
+ expect(empty).toHaveTextContent('«home.noAppsAddDescription»');
+ const ai = screen.getByTestId('home-no-apps-build-with-ai');
+ expect(ai).toHaveAttribute('href', '/studio');
+ expect(screen.getByTestId('home-no-apps-template')).toHaveAttribute('href', '/apps/setup/system/marketplace');
+ expect(screen.getByTestId('home-no-apps-marketplace')).toHaveAttribute('href', '/apps/setup/system/marketplace');
+ // The app tiles the retired page drew are gone: Setup and Studio are no app of the viewer's.
+ expect(screen.queryByText('Studio')).not.toBeInTheDocument();
+ });
+
+ it('opens Studio on a new package where no AI agent is served', () => {
+ viewer.aiEnabled = false;
+ render();
+ expect(screen.queryByTestId('home-no-apps-build-with-ai')).not.toBeInTheDocument();
+ expect(screen.getByTestId('home-no-apps-new-in-studio')).toBeInTheDocument();
+ });
+
+ it('tells an admin without manage_metadata why there is no door', () => {
+ viewer.canAuthor = false;
+ render();
+ expect(screen.getByTestId('home-no-apps')).toHaveTextContent('«home.noAppsTitle»');
+ expect(screen.getByTestId('home-authoring-gate-reason-empty')).toHaveTextContent('«home.build.noCapability»');
+ expect(screen.queryByTestId('home-no-apps-build-with-ai')).not.toBeInTheDocument();
+ });
+
+ it('tells a member their administrator shares apps with them, and offers no door', () => {
+ viewer.isAdmin = false;
+ appsFixture = [];
+ render();
+ const empty = screen.getByTestId('home-no-apps');
+ expect(empty).toHaveTextContent('«home.noAppsDescription»');
+ expect(empty).not.toHaveTextContent('«home.noAppsAddDescription»');
+ expect(screen.queryByTestId('home-no-apps-template')).not.toBeInTheDocument();
+ });
+
+ it('is not drawn once the viewer has a product app', () => {
+ appsFixture = [SETUP, { name: 'crm', label: 'CRM', _packageId: 'com.acme.crm' }];
+ render();
+ expect(screen.queryByTestId('home-no-apps')).not.toBeInTheDocument();
+ });
+});
diff --git a/ui/packages/app-shell/src/console/home/__tests__/HomePage.myWork-12602.test.tsx b/ui/packages/app-shell/src/console/home/__tests__/HomePage.myWork-12602.test.tsx
index c2c67e05208..085ce5f9e25 100644
--- a/ui/packages/app-shell/src/console/home/__tests__/HomePage.myWork-12602.test.tsx
+++ b/ui/packages/app-shell/src/console/home/__tests__/HomePage.myWork-12602.test.tsx
@@ -130,7 +130,8 @@ vi.mock('../../../runtime-config', () => ({
}));
vi.mock('../../../hooks/useRecentItems', () => ({ useRecentItems: () => ({ recentItems: [] }) }));
vi.mock('../../../hooks/useFavorites', () => ({ useFavorites: () => ({ favorites: [] }) }));
-vi.mock('../../../hooks/useAiSurface', () => ({ resolveAiApiBase: () => '' }));
+// `useAiSurfaceEnabled`: the desktop no-apps page's 「Add app」 doors read it (objectstack#36732).
+vi.mock('../../../hooks/useAiSurface', () => ({ resolveAiApiBase: () => '', useAiSurfaceEnabled: () => ({ enabled: false, loading: false }) }));
// The drafts row's two seams, the ones the retired banner read.
vi.mock('../../../preview/usePendingDrafts', () => ({
usePendingDrafts: () => ({ count: state.draftCount, entries: state.draftEntries }),
@@ -286,6 +287,18 @@ describe('two columns until an inbox row can say what kind it is (objectui#12602
});
});
+
+/**
+ * objectstack#36732 — from 768 px up a viewer with no product app is drawn the
+ * no-apps empty state (`HomePage.desktopNoApps-36732.test.tsx`); the empty
+ * state these cases read is a phone's, so they render at phone width.
+ */
+function atPhoneWidth() {
+ const real = window.innerWidth;
+ Object.defineProperty(window, 'innerWidth', { value: 375, configurable: true, writable: true });
+ return () => Object.defineProperty(window, 'innerWidth', { value: real, configurable: true, writable: true });
+}
+
describe('the pending-drafts row (objectui#12602)', () => {
const DRAFTS = [
{ type: 'object', name: 'ticket', label: 'Ticket', packageId: 'studio_test' },
@@ -336,10 +349,27 @@ describe('the pending-drafts row (objectui#12602)', () => {
});
it('is still offered with no app yet — the moment the assistant drafted the first one', async () => {
+ const restoreWidth = atPhoneWidth();
+ try {
+ state.apps = [];
+ state.draftCount = 1;
+ state.draftEntries = [{ type: 'app', name: 'helpdesk', packageId: 'p' }];
+ render();
+ await userEvent.setup().click(screen.getByTestId('pending-drafts-publish'));
+ expect(publishAllMock).toHaveBeenCalledTimes(1);
+ } finally {
+ restoreWidth();
+ }
+ });
+
+ it('objectstack#36732 — on a desktop with no app it is drawn above the no-apps page', async () => {
state.apps = [];
state.draftCount = 1;
state.draftEntries = [{ type: 'app', name: 'helpdesk', packageId: 'p' }];
render();
+ const row = screen.getByTestId('home-pending-drafts');
+ const empty = screen.getByTestId('home-no-apps');
+ expect(row.compareDocumentPosition(empty) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
await userEvent.setup().click(screen.getByTestId('pending-drafts-publish'));
expect(publishAllMock).toHaveBeenCalledTimes(1);
});
diff --git a/ui/packages/app-shell/src/console/home/__tests__/HomePage.phoneTapTargets-29147.test.tsx b/ui/packages/app-shell/src/console/home/__tests__/HomePage.phoneTapTargets-29147.test.tsx
index bb9d7dc6c1b..a479825ba06 100644
--- a/ui/packages/app-shell/src/console/home/__tests__/HomePage.phoneTapTargets-29147.test.tsx
+++ b/ui/packages/app-shell/src/console/home/__tests__/HomePage.phoneTapTargets-29147.test.tsx
@@ -193,14 +193,31 @@ describe('the greeting row (objectstack#29147)', () => {
});
it('with no app yet, the empty state\'s "Ask AI" is 44 px below sm', async () => {
- state.apps = [];
- state.agents = [{ name: 'ask' }];
- state.askAgent = true;
- render();
- expectPhoneTarget(await screen.findByTestId('home-ask-ai'), ['h-10'], ['max-sm:h-11']);
+ const restoreWidth = atPhoneWidth();
+ try {
+ state.apps = [];
+ state.agents = [{ name: 'ask' }];
+ state.askAgent = true;
+ render();
+ expectPhoneTarget(await screen.findByTestId('home-ask-ai'), ['h-10'], ['max-sm:h-11']);
+ } finally {
+ restoreWidth();
+ }
});
});
+
+/**
+ * objectstack#36732 — from 768 px up a viewer with no product app is drawn the
+ * no-apps empty state (`HomePage.desktopNoApps-36732.test.tsx`); the empty
+ * state these cases read is a phone's, so they render at phone width.
+ */
+function atPhoneWidth() {
+ const real = window.innerWidth;
+ Object.defineProperty(window, 'innerWidth', { value: 375, configurable: true, writable: true });
+ return () => Object.defineProperty(window, 'innerWidth', { value: real, configurable: true, writable: true });
+}
+
describe('"Your apps" (objectstack#29147)', () => {
it('the heading\'s links are 44 px tall below sm', () => {
render();
diff --git a/ui/packages/app-shell/src/console/setupFirstPageSlot.tsx b/ui/packages/app-shell/src/console/setupFirstPageSlot.tsx
new file mode 100644
index 00000000000..bfdb57fd861
--- /dev/null
+++ b/ui/packages/app-shell/src/console/setupFirstPageSlot.tsx
@@ -0,0 +1,58 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * The Setup app's first page: what a host draws above it (objectstack#36732).
+ *
+ * From 768 px up the platform home page retired, so an administrator who has
+ * an app no longer passes through `/home`, where the host's first-run
+ * checklist used to sit. The maintainer's pick (item 5 of #36732, option A)
+ * moves it to the top of the Setup app's first page: the page Setup's root
+ * lands on for this member (`AppContent`'s `resolveLandingRoute`, the same
+ * answer the sidebar's first entry gives), not a page spelled here, so a
+ * re-ordered Setup navigation moves the checklist with it.
+ *
+ * The host hands the element in through this slot (the console's is its
+ * `FirstRunChecklist`, which decides itself who sees it and hides once the
+ * list is done). The slot is drawn from 768 px up only, so a phone is as it
+ * was: its Setup root is the app's menu (`PhoneAppHome`), and its `/home` is
+ * the app list alone (objectstack#35881). The no-apps empty state still draws
+ * the checklist through Home's own `checklist` slot.
+ *
+ * @module
+ */
+
+import * as React from 'react';
+
+/** Draws what the host puts above the Setup app's first page, or nothing. */
+export type SetupFirstPageSlot = () => React.ReactNode;
+
+const SetupFirstPageSlotContext = React.createContext(null);
+
+/** Provides the host's element for the top of the Setup app's first page. */
+export function SetupFirstPageSlotProvider({
+ value,
+ children,
+}: {
+ value: SetupFirstPageSlot | null;
+ children: React.ReactNode;
+}) {
+ return {children};
+}
+
+/** The host's element for the top of the Setup app's first page, if any. */
+export function useSetupFirstPageSlot(): SetupFirstPageSlot | null {
+ return React.useContext(SetupFirstPageSlotContext);
+}
+
+/**
+ * Is this in-app path the landing route? `landing` is `resolveLandingRoute`'s
+ * answer, relative to the app (`dashboard/system_overview`, possibly with a
+ * query of its own); `inAppPath` is the location's path after `/apps/SEGMENT/`.
+ * The query is not compared: an overlay in the URL (`?palette=1`) is still the
+ * first page.
+ */
+export function isLandingPath(inAppPath: string, landing: string): boolean {
+ const trim = (path: string) => path.split(/[?#]/)[0].replace(/^\/+|\/+$/g, '');
+ const target = trim(landing);
+ return target !== '' && trim(inAppPath) === target;
+}
diff --git a/ui/packages/app-shell/src/context/LastAppProvider.tsx b/ui/packages/app-shell/src/context/LastAppProvider.tsx
index 5752e389183..9966eb3369f 100644
--- a/ui/packages/app-shell/src/context/LastAppProvider.tsx
+++ b/ui/packages/app-shell/src/context/LastAppProvider.tsx
@@ -1,8 +1,8 @@
/**
* LastAppProvider
*
- * The app this person last had open (objectstack#35881): where a phone lands
- * after sign-in. On a phone it comes first, ahead of the app the product
+ * The app this person last had open (objectstack#35881): where a sign-in
+ * lands, on a phone and, since objectstack#36732, on a desktop. On a phone it comes first, ahead of the app the product
* declares as default, which applies only when there is no record yet (ruling
* 7045309332, 「上次用的优先」). Stored per person, so it follows them to
* another device: one `sys_user_preference` row, `ui.app.last`, holding the
@@ -12,8 +12,10 @@
* adapter.
*
* Written whenever an app is open, at any width: it is the person's last app,
- * not their last phone app. Read only by the phone's landing:
- * `RootLandingRedirect` in the console app, through `resolvePhoneLandingPath`.
+ * not their last phone app. Read by the landing at every width
+ * (`RootLandingRedirect` in the console app; from 768 px up also the retired
+ * `/home` address, objectstack#36732) and by the desktop chrome's Home
+ * (`useHomePath`).
*
* @module
*/
diff --git a/ui/packages/app-shell/src/hooks/__tests__/useHomePath.servedAnswer-36732.test.tsx b/ui/packages/app-shell/src/hooks/__tests__/useHomePath.servedAnswer-36732.test.tsx
new file mode 100644
index 00000000000..945a26bba0b
--- /dev/null
+++ b/ui/packages/app-shell/src/hooks/__tests__/useHomePath.servedAnswer-36732.test.tsx
@@ -0,0 +1,95 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * objectstack#36732 — the desktop Home target never names an app the member's
+ * permission sets hide, wherever the chrome reads it.
+ *
+ * `useHomePath()` narrows through `useServedApps`, which narrows only below a
+ * `LauncherAppsProvider` whose `/me/apps` answer is held. `/studio/*` and
+ * `/ai/*` mount the chrome OUTSIDE that provider, and inside it the first
+ * read can still be out: in both places the list is unnarrowed, so the hook
+ * must name `/home` (the route that waits for the answer) and not resolve an
+ * app itself.
+ *
+ * These run the REAL provider and hook — no `useLauncherApps` mock — fed a
+ * `/me/apps` double.
+ */
+
+import '@testing-library/jest-dom/vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import React from 'react';
+import { cleanup, render, screen, waitFor } from '@testing-library/react';
+
+const state = vi.hoisted(() => ({
+ apps: [] as Array>,
+ lastApp: null as string | null,
+}));
+
+vi.mock('@object-ui/auth', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useAuth: () => ({ user: { id: 'u1' } }),
+}));
+vi.mock('../../providers/MetadataProvider', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useMetadata: () => ({ apps: state.apps, loading: false }),
+}));
+vi.mock('../usePhoneViewport', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ usePhoneViewport: () => false,
+}));
+vi.mock('../../context/LastAppProvider', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useLastApp: () => ({ lastApp: state.lastApp, settled: true, rememberApp: () => {} }),
+}));
+
+import { LauncherAppsProvider } from '../useLauncherApps';
+import { useHomePath } from '../useHomePath';
+
+const ENDPOINT = '/me-apps-double';
+
+function HomeProbe() {
+ return
{useHomePath()}
;
+}
+
+beforeEach(() => {
+ // `hr` is the member's last app, and a permission set hides it.
+ state.apps = [{ name: 'hr' }, { name: 'sales' }, { name: 'setup', _packageId: 'com.objectstack.setup' }];
+ state.lastApp = 'hr';
+});
+
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+});
+
+describe('objectstack#36732 — the desktop Home target and a set-hidden app', () => {
+ it('outside a LauncherAppsProvider (studio, ai) names /home, never the hidden last app', () => {
+ render();
+ expect(screen.getByTestId('home')).toHaveTextContent(/^\/home$/);
+ });
+
+ it('inside the provider names /home while the first read is out, then the first app it serves', async () => {
+ let answer!: (res: Response) => void;
+ const fetcher = vi.fn(() => new Promise((resolve) => (answer = resolve)));
+ render(
+
+
+ ,
+ );
+ expect(screen.getByTestId('home')).toHaveTextContent(/^\/home$/);
+ await waitFor(() => expect(fetcher).toHaveBeenCalled());
+ answer(new Response(JSON.stringify({ apps: [{ name: 'sales' }, { name: 'setup' }] }), { status: 200 }));
+ await waitFor(() => expect(screen.getByTestId('home')).toHaveTextContent(/^\/apps\/sales$/));
+ });
+
+ it('inside the provider, a failed read settles and falls open to the declared list', async () => {
+ vi.spyOn(console, 'warn').mockImplementation(() => {});
+ const fetcher = vi.fn(async () => new Response('{}', { status: 500 }));
+ render(
+
+
+ ,
+ );
+ await waitFor(() => expect(screen.getByTestId('home')).toHaveTextContent(/^\/apps\/hr$/));
+ });
+});
diff --git a/ui/packages/app-shell/src/hooks/__tests__/useHomePath.test.tsx b/ui/packages/app-shell/src/hooks/__tests__/useHomePath.test.tsx
index af031931dd0..8151a7d2fc6 100644
--- a/ui/packages/app-shell/src/hooks/__tests__/useHomePath.test.tsx
+++ b/ui/packages/app-shell/src/hooks/__tests__/useHomePath.test.tsx
@@ -24,16 +24,39 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
import { renderHook } from '@testing-library/react';
const metadata = vi.hoisted(() => ({ apps: undefined as unknown }));
+/** objectstack#36732 — the width and the person's last app. */
+const viewer = vi.hoisted(() => ({ phone: false, lastApp: null as string | null, hidden: [] as string[], settled: true }));
vi.mock('../../providers/MetadataProvider', async (importOriginal) => ({
...(await importOriginal>()),
useMetadata: () => ({ apps: metadata.apps }),
}));
+vi.mock('../usePhoneViewport', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ usePhoneViewport: () => viewer.phone,
+}));
+vi.mock('../../context/LastAppProvider', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useLastApp: () => ({ lastApp: viewer.lastApp, settled: true, rememberApp: () => {} }),
+}));
+
+// The member's `/me/apps` answer: the app names a permission set hides, and
+// whether that answer is held. The real provider is pinned in
+// `useHomePath.servedAnswer-36732.test.tsx`.
+vi.mock('../useLauncherApps', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useServedApps: (apps: Array<{ name?: string }>) => apps.filter((app) => !viewer.hidden.includes(app?.name ?? '')),
+ useServedAppsSettled: () => viewer.settled,
+}));
const { useHomePath } = await import('../useHomePath');
beforeEach(() => {
metadata.apps = undefined;
+ viewer.phone = false;
+ viewer.lastApp = null;
+ viewer.hidden = [];
+ viewer.settled = true;
});
describe('useHomePath', () => {
@@ -45,11 +68,35 @@ describe('useHomePath', () => {
expect(renderHook(() => useHomePath()).result.current).toBe('/apps/cloud_control');
});
- it('keeps the launcher on an ordinary environment — the unchanged status quo', () => {
+ it('a phone keeps its app list on an ordinary environment — unchanged', () => {
+ viewer.phone = true;
metadata.apps = [{ name: 'crm' }, { name: 'setup' }];
expect(renderHook(() => useHomePath()).result.current).toBe('/home');
});
+ it('a phone keeps the declared landing, whatever the last app', () => {
+ viewer.phone = true;
+ viewer.lastApp = 'crm';
+ metadata.apps = [{ name: 'crm' }, { name: 'cloud_control', isDefault: true }];
+ expect(renderHook(() => useHomePath()).result.current).toBe('/apps/cloud_control');
+ });
+
+ it('objectstack#36732 — a desktop goes to the last-used app, ahead of the declared default', () => {
+ viewer.lastApp = 'crm';
+ metadata.apps = [{ name: 'crm' }, { name: 'cloud_control', isDefault: true }];
+ expect(renderHook(() => useHomePath()).result.current).toBe('/apps/crm');
+ });
+
+ it('objectstack#36732 — a desktop with no record and no declaration goes to the first product app', () => {
+ metadata.apps = [{ name: 'setup' }, { name: 'crm' }];
+ expect(renderHook(() => useHomePath()).result.current).toBe('/apps/crm');
+ });
+
+ it('objectstack#36732 — a desktop with no product app keeps /home, the no-apps page', () => {
+ metadata.apps = [{ name: 'setup' }];
+ expect(renderHook(() => useHomePath()).result.current).toBe('/home');
+ });
+
it('answers the launcher while the app list is still in flight', () => {
// A LINK target, not a redirect: an in-flight answer costs nothing because
// the href settles long before a boot-time click. `/`'s resolver is the one
@@ -70,4 +117,25 @@ describe('useHomePath', () => {
rerender();
expect(result.current).toBe('/apps/cloud_control');
});
+
+ it('objectstack#36732 — a desktop with no held /me/apps answer names /home, which waits for it', () => {
+ viewer.settled = false;
+ viewer.lastApp = 'crm';
+ metadata.apps = [{ name: 'crm' }, { name: 'cloud_control', isDefault: true }];
+ expect(renderHook(() => useHomePath()).result.current).toBe('/home');
+ });
+
+ it('objectstack#36732 — a phone does not wait on the /me/apps answer', () => {
+ viewer.settled = false;
+ viewer.phone = true;
+ metadata.apps = [{ name: 'crm' }, { name: 'cloud_control', isDefault: true }];
+ expect(renderHook(() => useHomePath()).result.current).toBe('/apps/cloud_control');
+ });
+
+ it('objectstack#36732 — a desktop never goes to an app a permission set hides', () => {
+ viewer.lastApp = 'hr';
+ viewer.hidden = ['hr'];
+ metadata.apps = [{ name: 'hr' }, { name: 'sales' }];
+ expect(renderHook(() => useHomePath()).result.current).toBe('/apps/sales');
+ });
});
diff --git a/ui/packages/app-shell/src/hooks/useAddAppEntries.ts b/ui/packages/app-shell/src/hooks/useAddAppEntries.ts
new file mode 100644
index 00000000000..d6c69ccfdd1
--- /dev/null
+++ b/ui/packages/app-shell/src/hooks/useAddAppEntries.ts
@@ -0,0 +1,67 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * The 「Add app」 choices, and who is offered them: the sidebar app menu's
+ * 「Add app」 submenu (objectstack#36112) and the desktop's no-apps empty
+ * state (objectstack#36732) read the one list, so both offer the same doors
+ * to the same viewers.
+ *
+ * @module
+ */
+
+import type * as React from 'react';
+import { Hammer, LayoutGrid, Store } from 'lucide-react';
+import { useObjectTranslation } from '@object-ui/i18n';
+import { useWorkspaceAdminStatus } from '@object-ui/auth';
+import { useCanAuthorMetadata } from './useCanAuthorMetadata.js';
+import { useAiSurfaceEnabled } from './useAiSurface.js';
+import { isAiStudioEnabled, isMarketplaceEnabled } from '../runtime-config.js';
+import { STUDIO_NEW_PACKAGE_PATH } from '../views/studio-design/studioNewPackage.js';
+
+/** The marketplace, where templates and packages are installed from. */
+const MARKETPLACE_PATH = '/apps/setup/system/marketplace';
+
+/** One 「Add app」 choice: where it goes, and how it is named. */
+export interface AddAppEntry {
+ key: string;
+ to: string;
+ label: string;
+ icon: React.ComponentType<{ className?: string }>;
+}
+
+/**
+ * Whether this viewer is offered 「Add app」 at all, by the gates Home's
+ * builder chips read: a workspace admin who may author metadata, on a
+ * deployment that offers AI authoring or mounts a marketplace.
+ */
+export function useMayAddApp(): boolean {
+ const { isAdmin } = useWorkspaceAdminStatus();
+ const canAuthor = useCanAuthorMetadata();
+ return isAdmin && canAuthor && (isAiStudioEnabled() || isMarketplaceEnabled());
+}
+
+/**
+ * The 「Add app」 choices: building with AI where the deployment offers AI
+ * authoring and serves an agent, else a new package in Studio; templates and
+ * the marketplace where a marketplace is mounted. Read only for a viewer
+ * {@link useMayAddApp} lets in, so no one else pays the agent-catalog read.
+ */
+export function useAddAppEntries(): AddAppEntry[] {
+ const { t } = useObjectTranslation();
+ const { enabled: aiEnabled } = useAiSurfaceEnabled();
+ const entries: AddAppEntry[] = [];
+ if (isAiStudioEnabled()) {
+ entries.push(
+ aiEnabled
+ ? { key: 'build-with-ai', to: '/studio', label: t('home.buildWithAI', { defaultValue: 'Build with AI' }), icon: Hammer }
+ : { key: 'new-in-studio', to: STUDIO_NEW_PACKAGE_PATH, label: t('home.build.inStudio', { defaultValue: 'New in Studio' }), icon: Hammer },
+ );
+ }
+ if (isMarketplaceEnabled()) {
+ entries.push(
+ { key: 'template', to: MARKETPLACE_PATH, label: t('home.template.title', { defaultValue: 'Start with a template' }), icon: LayoutGrid },
+ { key: 'marketplace', to: MARKETPLACE_PATH, label: t('layout.systemNav.appMarketplace', { defaultValue: 'App Marketplace' }), icon: Store },
+ );
+ }
+ return entries;
+}
diff --git a/ui/packages/app-shell/src/hooks/useHomePath.ts b/ui/packages/app-shell/src/hooks/useHomePath.ts
index 2e72003cf8b..7937508fd0d 100644
--- a/ui/packages/app-shell/src/hooks/useHomePath.ts
+++ b/ui/packages/app-shell/src/hooks/useHomePath.ts
@@ -26,14 +26,38 @@
*/
import { useMetadata } from '../providers/MetadataProvider.js';
+import { useLastApp } from '../context/LastAppProvider.js';
+import { usePhoneViewport } from './usePhoneViewport.js';
+import { useServedApps, useServedAppsSettled } from './useLauncherApps.js';
import {
HOME_LAUNCHER_PATH,
resolveDeclaredHomePath,
+ resolveDesktopHomePath,
type DeclaredHomeApp,
} from '../utils/homePath.js';
-/** The path the console chrome's Home affordances navigate to. */
+/**
+ * The path the console chrome's Home affordances navigate to. From 768 px up
+ * the platform home page is retired (objectstack#36732), so Home is where `/`
+ * lands a desktop: the last-used app, the declared default, the first product
+ * app (`resolveDesktopHomePath`), among the apps the member's permission sets
+ * show — and `/home`, which resolves that order itself, until a `/me/apps`
+ * answer is held. A phone keeps the declared landing, else its app list at
+ * `/home`.
+ */
export function useHomePath(): string {
const { apps } = useMetadata();
- return resolveDeclaredHomePath(apps as DeclaredHomeApp[] | undefined) ?? HOME_LAUNCHER_PATH;
+ const phone = usePhoneViewport();
+ const { lastApp } = useLastApp();
+ // objectstack#36732 — never an app the member's permission sets hide
+ // (`/me/apps`), the same narrowing the desktop landing reads.
+ const served = useServedApps((apps ?? []) as DeclaredHomeApp[]);
+ const settled = useServedAppsSettled();
+ if (phone) return resolveDeclaredHomePath(apps as DeclaredHomeApp[] | undefined) ?? HOME_LAUNCHER_PATH;
+ // Outside a `LauncherAppsProvider` (`/studio/*`, `/ai/*`) nothing narrows the
+ // list, and inside one the first read may still be out: either way this
+ // hook cannot tell which apps a set hides, so it names `/home`, whose
+ // desktop route resolves the same order once the answer is held.
+ if (!settled) return HOME_LAUNCHER_PATH;
+ return resolveDesktopHomePath(served, lastApp);
}
diff --git a/ui/packages/app-shell/src/hooks/useLauncherApps.tsx b/ui/packages/app-shell/src/hooks/useLauncherApps.tsx
index e12565782fe..14abe73c01d 100644
--- a/ui/packages/app-shell/src/hooks/useLauncherApps.tsx
+++ b/ui/packages/app-shell/src/hooks/useLauncherApps.tsx
@@ -231,6 +231,20 @@ export function useServedApps(apps: readonly T[]): T[
return narrowByAnswer(useContext(LauncherAppsContext), apps);
}
+/**
+ * Whether {@link useServedApps} answers from a SETTLED `/me/apps` read: a
+ * {@link LauncherAppsProvider} is mounted above and its first read is not
+ * out. `false` outside a provider — where the list passes unnarrowed — and
+ * while the first read is pending. A surface that must not name an app a
+ * permission set hides (the desktop Home target, objectstack#36732) acts on
+ * its narrowed list only when this is `true`, and otherwise defers to a route
+ * that waits for the answer.
+ */
+export function useServedAppsSettled(): boolean {
+ const state = useContext(LauncherAppsContext);
+ return state !== null && state.status !== 'pending';
+}
+
function narrowByAnswer(state: LauncherAppsState | null, apps: readonly T[]): T[] {
if (state?.status !== 'ready') return [...apps];
const { served, asked } = state.answer;
diff --git a/ui/packages/app-shell/src/index.ts b/ui/packages/app-shell/src/index.ts
index 8e70689398c..835bf2fd9b6 100644
--- a/ui/packages/app-shell/src/index.ts
+++ b/ui/packages/app-shell/src/index.ts
@@ -85,6 +85,10 @@ export {
LoadingFallback,
} from './console/ConsoleShell.js';
+// objectstack#36732 — what a host draws above the Setup app's first page (the
+// console's first-run checklist, now that the desktop's home page retired).
+export { SetupFirstPageSlotProvider, type SetupFirstPageSlot } from './console/setupFirstPageSlot.js';
+
// Host-app route policy (ADR-0048) — which app's `/apps//…` URL a
// framework-owned, app-INDEPENDENT page should build, and the two predicates it
// is defined in terms of. Published from the package root (objectui#4280)
@@ -128,7 +132,7 @@ export {
// emptiness heuristic on top of the SAME declaration reader the chrome's Home
// affordances use, so the post-login landing and the top-bar logo cannot name
// two different homes.
-export { HOME_LAUNCHER_PATH, resolveDeclaredHomePath } from './utils/index.js';
+export { HOME_LAUNCHER_PATH, resolveDeclaredHomePath, resolveDesktopHomePath } from './utils/index.js';
// `a810bb2ae` — ONE read of the ADR-0112 failure envelope, published so a
// consumer OUTSIDE this package inherits the pinned rule instead of writing a
diff --git a/ui/packages/app-shell/src/layout/SidebarAppMenu.tsx b/ui/packages/app-shell/src/layout/SidebarAppMenu.tsx
index 367de8dbf56..bfd7d20f166 100644
--- a/ui/packages/app-shell/src/layout/SidebarAppMenu.tsx
+++ b/ui/packages/app-shell/src/layout/SidebarAppMenu.tsx
@@ -35,19 +35,16 @@ import {
DropdownMenuTrigger,
Input,
} from '@object-ui/components';
-import { Blocks, Check, ChevronDown, Hammer, LayoutGrid, Plus, Store } from 'lucide-react';
+import { Blocks, Check, ChevronDown, Plus } from 'lucide-react';
import { useObjectTranslation } from '@object-ui/i18n';
-import { useAuth, useWorkspaceAdminStatus } from '@object-ui/auth';
+import { useAuth } from '@object-ui/auth';
import { useMetadata } from '../providers/MetadataProvider.js';
import { matchAppBySegment } from '../utils/index.js';
import { appAddressSegment, appStudioDesignPath } from '../utils/appRoute.js';
import { useServedAppLabel } from '../hooks/useServedAppLabel.js';
import { useLauncherApps } from '../hooks/useLauncherApps.js';
-import { useCanAuthorMetadata } from '../hooks/useCanAuthorMetadata.js';
import { useStudioEntryGate } from '../hooks/useStudioDesignGate.js';
-import { useAiSurfaceEnabled } from '../hooks/useAiSurface.js';
-import { isAiStudioEnabled, isMarketplaceEnabled } from '../runtime-config.js';
-import { STUDIO_NEW_PACKAGE_PATH } from '../views/studio-design/studioNewPackage.js';
+import { useAddAppEntries, useMayAddApp } from '../hooks/useAddAppEntries.js';
import { AppMark } from './AppMark.js';
import { useDesignMode } from './designMode.js';
import { postureHasOrgWall, useTenancyPosture } from '../hooks/useTenancyPosture.js';
@@ -55,54 +52,6 @@ import { postureHasOrgWall, useTenancyPosture } from '../hooks/useTenancyPosture
/** The app count above which the menu draws a search field over the list. */
export const APP_MENU_SEARCH_FROM = 8;
-/** The marketplace, where templates and packages are installed from. */
-const MARKETPLACE_PATH = '/apps/setup/system/marketplace';
-
-/** One 「Add app」 choice: where it goes, and how it is named. */
-interface AddAppEntry {
- key: string;
- to: string;
- label: string;
- icon: React.ComponentType<{ className?: string }>;
-}
-
-/**
- * Whether this viewer is offered 「Add app」 at all, by the gates Home's
- * builder chips read: a workspace admin who may author metadata, on a
- * deployment that offers AI authoring or mounts a marketplace.
- */
-function useMayAddApp(): boolean {
- const { isAdmin } = useWorkspaceAdminStatus();
- const canAuthor = useCanAuthorMetadata();
- return isAdmin && canAuthor && (isAiStudioEnabled() || isMarketplaceEnabled());
-}
-
-/**
- * The 「Add app」 choices: building with AI where the deployment offers AI
- * authoring and serves an agent, else a new package in Studio; templates and
- * the marketplace where a marketplace is mounted. Read only for a viewer
- * {@link useMayAddApp} lets in, so no one else pays the agent-catalog read.
- */
-function useAddAppEntries(): AddAppEntry[] {
- const { t } = useObjectTranslation();
- const { enabled: aiEnabled } = useAiSurfaceEnabled();
- const entries: AddAppEntry[] = [];
- if (isAiStudioEnabled()) {
- entries.push(
- aiEnabled
- ? { key: 'build-with-ai', to: '/studio', label: t('home.buildWithAI', { defaultValue: 'Build with AI' }), icon: Hammer }
- : { key: 'new-in-studio', to: STUDIO_NEW_PACKAGE_PATH, label: t('home.build.inStudio', { defaultValue: 'New in Studio' }), icon: Hammer },
- );
- }
- if (isMarketplaceEnabled()) {
- entries.push(
- { key: 'template', to: MARKETPLACE_PATH, label: t('home.template.title', { defaultValue: 'Start with a template' }), icon: LayoutGrid },
- { key: 'marketplace', to: MARKETPLACE_PATH, label: t('layout.systemNav.appMarketplace', { defaultValue: 'App Marketplace' }), icon: Store },
- );
- }
- return entries;
-}
-
/**
* What 「Edit app」 does for this viewer, or `null` where it is not drawn: it
* turns the shell's design mode on for the app on screen, in place.
diff --git a/ui/packages/app-shell/src/layout/__tests__/AppHeader.homeMark-12605.test.tsx b/ui/packages/app-shell/src/layout/__tests__/AppHeader.homeMark-12605.test.tsx
index 23076e818fc..20768dacab7 100644
--- a/ui/packages/app-shell/src/layout/__tests__/AppHeader.homeMark-12605.test.tsx
+++ b/ui/packages/app-shell/src/layout/__tests__/AppHeader.homeMark-12605.test.tsx
@@ -107,6 +107,9 @@ vi.mock('@object-ui/auth', async (importOriginal) => ({
useWorkspaceAdminStatus: () => ({ isAdmin: false, isResolved: true }),
}));
+/** objectstack#36732 — the desktop's home for the one product app below. */
+const DESKTOP_HOME = '/apps/com.example.crm';
+
vi.mock('../../providers/MetadataProvider', () => ({
useMetadata: () => ({
apps: [{ name: 'crm', label: 'CRM', _packageId: 'com.example.crm' }],
@@ -120,6 +123,15 @@ vi.mock('../../providers/AdapterProvider', () => ({
useAdapter: () => ({ find: () => Promise.resolve({ data: [] }), getClient: () => undefined }),
}));
+// objectstack#36732 — on `/apps/*` the console's chrome sits under
+// `LauncherAppsProvider`, whose `/me/apps` answer is held once the first read
+// lands; this host mounts none, so the held answer is stated here. Without one
+// a desktop's Home names `/home` (pinned in `useHomePath.servedAnswer-36732`).
+vi.mock('../../hooks/useLauncherApps', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useServedAppsSettled: () => true,
+}));
+
import { AppHeader } from '../AppHeader';
import { CommandPaletteProvider } from '../../context/CommandPaletteProvider';
import { GO_HOME_SHORTCUT, useAdvertisedShortcuts, type ShortcutChord } from '../../chrome/advertisedShortcuts';
@@ -232,17 +244,19 @@ describe('inside an app the product mark is the way home (objectui#12605)', () =
expect(separator.textContent).toBe('');
});
- it('the mark is named 「PRODUCT home」 and links to `/home`', () => {
+ // objectstack#36732 — from 768 px up home is where `/` lands: with no last
+ // app and nothing declared, the first product app, not the retired page.
+ it('the mark is named 「PRODUCT home」 and links home', () => {
mount('/apps/crm/lead');
const link = screen.getByRole('link', { name: `${getProductName()} home` });
expect(link).toBe(mark());
- expect(link).toHaveAttribute('href', '/home');
+ expect(link).toHaveAttribute('href', DESKTOP_HOME);
});
- it('a click on the mark lands on `/home`', () => {
+ it('a click on the mark lands home', () => {
mount('/apps/crm/lead');
fireEvent.click(mark());
- expect(location()).toHaveAttribute('data-path', '/home');
+ expect(location()).toHaveAttribute('data-path', DESKTOP_HOME);
});
it('the app pill is drawn at every width — no breakpoint class hides it', () => {
@@ -299,7 +313,7 @@ describe('CONTROL — the home page draws the same mark and leaves the chord alo
it('one mark, named and linked the same way; no `/` rule and no advertisement', () => {
mount('/home');
expect(screen.getByRole('link', { name: `${getProductName()} home` })).toBe(mark());
- expect(mark()).toHaveAttribute('href', '/home');
+ expect(mark()).toHaveAttribute('href', DESKTOP_HOME);
expect(mark()).toHaveAttribute('title', getProductName());
expect(screen.queryByTestId('app-bar-home-separator')).not.toBeInTheDocument();
expect(advertised().map((s) => s.id)).not.toContain('go-home');
diff --git a/ui/packages/app-shell/src/layout/__tests__/AppHeader.studioVariant-11863.test.tsx b/ui/packages/app-shell/src/layout/__tests__/AppHeader.studioVariant-11863.test.tsx
index 181f6a16c38..fd5d1ada110 100644
--- a/ui/packages/app-shell/src/layout/__tests__/AppHeader.studioVariant-11863.test.tsx
+++ b/ui/packages/app-shell/src/layout/__tests__/AppHeader.studioVariant-11863.test.tsx
@@ -213,11 +213,14 @@ describe('AppHeader `studio` variant: the /studio frame (objectui#11863)', () =>
expect(brandLink()).toHaveAttribute('href', '/home');
});
- it('links the brand to the declared landing, the home the post-login redirect names', () => {
+ it('links the brand to /home even where an app declares a landing: Studio cannot tell which apps a set hides (objectstack#36732)', () => {
+ // Studio sits outside the `/me/apps` provider, so from 768 px up the brand
+ // names `/home`, the route that lands in the declared app once it knows
+ // the member's permission sets do not hide it.
apps = [{ name: 'crm' }, { name: 'helpdesk', isDefault: true }];
renderHeader('studio');
- expect(brandLink()).toHaveAttribute('href', '/apps/helpdesk');
+ expect(brandLink()).toHaveAttribute('href', '/home');
});
it("carries the console's right-hand cluster: inbox, help and the account menu", () => {
diff --git a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.appIdentity-12201.test.tsx b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.appIdentity-12201.test.tsx
index a241773148c..abcb310e05c 100644
--- a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.appIdentity-12201.test.tsx
+++ b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.appIdentity-12201.test.tsx
@@ -65,6 +65,15 @@ vi.mock('../../providers/MetadataProvider', () => ({
useMetadata: () => ({ apps }),
}));
+// objectstack#36732 — on `/apps/*` the console's chrome sits under
+// `LauncherAppsProvider`, whose `/me/apps` answer is held once the first read
+// lands; this host mounts none, so the held answer is stated here. Without one
+// a desktop's Home names `/home` (pinned in `useHomePath.servedAnswer-36732`).
+vi.mock('../../hooks/useLauncherApps', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useServedAppsSettled: () => true,
+}));
+
import { AppSwitcher } from '../AppSwitcher';
import { OBJECT_COLORS } from '@objectstack/spec/data';
import { OBJECT_COLOR_TILE_CLASS } from '@object-ui/components';
diff --git a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.homeMenu-12605.test.tsx b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.homeMenu-12605.test.tsx
index bb7373a2feb..eb7033f77a3 100644
--- a/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.homeMenu-12605.test.tsx
+++ b/ui/packages/app-shell/src/layout/__tests__/AppSwitcher.homeMenu-12605.test.tsx
@@ -64,6 +64,15 @@ vi.mock('../../providers/MetadataProvider', () => ({
useMetadata: () => ({ apps }),
}));
+// objectstack#36732 — on `/apps/*` the console's chrome sits under
+// `LauncherAppsProvider`, whose `/me/apps` answer is held once the first read
+// lands; this host mounts none, so the held answer is stated here. Without one
+// a desktop's Home names `/home` (pinned in `useHomePath.servedAnswer-36732`).
+vi.mock('../../hooks/useLauncherApps', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useServedAppsSettled: () => true,
+}));
+
import { AppSwitcher } from '../AppSwitcher';
const HOTCRM = { name: 'hotcrm', label: 'HotCRM', icon: 'flame', _packageId: 'com.acme.hotcrm' };
@@ -138,7 +147,9 @@ describe('the app pill\'s menu (objectui#12605)', () => {
it('「Back to home」 links to home and shows the ⌘⇧H keycaps', () => {
renderSwitcher('hotcrm');
const home = menu().getByTestId('app-switcher-home');
- expect(home).toHaveAttribute('href', '/home');
+ // objectstack#36732 — from 768 px up home is where `/` lands (no last app
+ // here, nothing declared: the first product app), not the retired page.
+ expect(home).toHaveAttribute('href', '/apps/com.acme.hotcrm');
expect(home.querySelector('kbd')).toHaveTextContent('⌘⇧H');
});
diff --git a/ui/packages/app-shell/src/utils/__tests__/homePath.test.ts b/ui/packages/app-shell/src/utils/__tests__/homePath.test.ts
index cd3b4de1465..7f8e9d66f7c 100644
--- a/ui/packages/app-shell/src/utils/__tests__/homePath.test.ts
+++ b/ui/packages/app-shell/src/utils/__tests__/homePath.test.ts
@@ -21,7 +21,7 @@
* by `apps/console/src/components/landingHomeParity-7256.test.ts`.
*/
import { describe, it, expect } from 'vitest';
-import { HOME_LAUNCHER_PATH, resolveDeclaredHomePath } from '../homePath';
+import { HOME_LAUNCHER_PATH, resolveDeclaredHomePath, resolveDesktopHomePath } from '../homePath';
describe('resolveDeclaredHomePath', () => {
it('answers the declared app root — cloud control plane, the card shape', () => {
@@ -97,3 +97,29 @@ describe('resolveDeclaredHomePath', () => {
expect(HOME_LAUNCHER_PATH).toBe('/home');
});
});
+
+// objectstack#36732 — the desktop's Home, now the platform home page is retired.
+describe('resolveDesktopHomePath', () => {
+ const SETUP = { name: 'setup', _packageId: 'com.objectstack.setup' };
+ const STUDIO = { name: 'studio', _packageId: 'com.objectstack.studio' };
+
+ it('the last-used app first, then the declaration, then the first product app', () => {
+ const apps = [SETUP, { name: 'crm', _packageId: 'com.acme.crm' }, { name: 'ops', isDefault: true }];
+ expect(resolveDesktopHomePath(apps, 'crm')).toBe('/apps/com.acme.crm');
+ expect(resolveDesktopHomePath(apps, null)).toBe('/apps/ops');
+ expect(resolveDesktopHomePath([SETUP, STUDIO, { name: 'sales' }], null)).toBe('/apps/sales');
+ });
+
+ it('a removed, hidden or switched-off last app is no answer', () => {
+ const apps = [{ name: 'a' }, { name: 'h', hidden: true }, { name: 'off', active: false }];
+ expect(resolveDesktopHomePath(apps, 'gone')).toBe('/apps/a');
+ expect(resolveDesktopHomePath(apps, 'h')).toBe('/apps/a');
+ expect(resolveDesktopHomePath(apps, 'off')).toBe('/apps/a');
+ });
+
+ it('no product app: the no-apps page at the launcher path', () => {
+ expect(resolveDesktopHomePath([SETUP, STUDIO], null)).toBe(HOME_LAUNCHER_PATH);
+ expect(resolveDesktopHomePath([], null)).toBe(HOME_LAUNCHER_PATH);
+ expect(resolveDesktopHomePath(undefined, undefined)).toBe(HOME_LAUNCHER_PATH);
+ });
+});
diff --git a/ui/packages/app-shell/src/utils/homePath.ts b/ui/packages/app-shell/src/utils/homePath.ts
index 42a9d2dddb3..9c30390a701 100644
--- a/ui/packages/app-shell/src/utils/homePath.ts
+++ b/ui/packages/app-shell/src/utils/homePath.ts
@@ -45,6 +45,8 @@
*/
import { appAddressSegment } from './appRoute.js';
+import { isPlatformBuiltinApp } from './platformApp.js';
+import { SETUP_APP_NAME, SETUP_APP_PACKAGE_ID } from '../console/setupApp.js';
/**
* The multi-app workspace launcher — the environment layer's own home
@@ -64,6 +66,8 @@ export type DeclaredHomeApp = {
isDefault?: boolean;
/** ADR-0048 owning package — the app's canonical route segment. */
_packageId?: string;
+ active?: boolean;
+ hidden?: boolean;
};
/**
@@ -89,3 +93,45 @@ export function resolveDeclaredHomePath(
const declared = (apps ?? []).find((a) => a?.isDefault === true && Boolean(a?.name));
return declared ? `/apps/${appAddressSegment(apps, declared)}` : null;
}
+
+/** An app this viewer can see: not switched off, not hidden. */
+export function isVisible(app: DeclaredHomeApp): boolean {
+ return app.active !== false && app.hidden !== true;
+}
+
+/**
+ * Is this an app somebody put into the environment rather than one the
+ * platform ships into every deployment (Setup by package id or name, Studio
+ * and Account by the platform's reserved package namespace)? A viewer with
+ * none has no product app yet: the desktop's Home draws its no-apps empty
+ * state (objectstack#36732).
+ */
+export function isProductApp(app: { name?: unknown; _packageId?: unknown }): boolean {
+ if (app._packageId === SETUP_APP_PACKAGE_ID || app.name === SETUP_APP_NAME) return false;
+ return !isPlatformBuiltinApp(app);
+}
+
+/**
+ * Where "home" is from 768 px up, now the platform home page is retired
+ * (objectstack#36732): the app this person last had open while it is still an
+ * active, visible app; else the App the product declares `isDefault`; else the
+ * first visible product app; else {@link HOME_LAUNCHER_PATH}, which on a
+ * desktop draws only the no-apps empty state.
+ *
+ * The same answer `/` redirects to on a desktop (`resolveDesktopLandingPath`
+ * in apps/console), so a Home affordance and the post-login landing cannot
+ * disagree; `landingHomeParity-7256.test.ts` holds the two equal. A phone keeps
+ * {@link resolveDeclaredHomePath}: its Home still opens the app list.
+ */
+export function resolveDesktopHomePath(
+ apps: readonly DeclaredHomeApp[] | null | undefined,
+ lastApp: string | null | undefined,
+): string {
+ const list = (apps ?? []).filter((a): a is DeclaredHomeApp & { name: string } => Boolean(a?.name));
+ const last = lastApp ? list.find((a) => a.name === lastApp && isVisible(a)) : undefined;
+ if (last) return `/apps/${appAddressSegment(apps, last)}`;
+ const declared = resolveDeclaredHomePath(apps);
+ if (declared) return declared;
+ const first = list.find((a) => isVisible(a) && isProductApp(a));
+ return first ? `/apps/${appAddressSegment(apps, first)}` : HOME_LAUNCHER_PATH;
+}
diff --git a/ui/packages/app-shell/src/utils/index.ts b/ui/packages/app-shell/src/utils/index.ts
index 5456351a5cc..4a5fabf5e10 100644
--- a/ui/packages/app-shell/src/utils/index.ts
+++ b/ui/packages/app-shell/src/utils/index.ts
@@ -58,7 +58,7 @@ export type { NotificationTarget } from './appRoute.js';
// Where "home" is (objectui#7256) — the declared landing, read once and shared
// by the `/` redirect (apps/console) and the chrome's Home affordances.
-export { HOME_LAUNCHER_PATH, resolveDeclaredHomePath } from './homePath.js';
+export { HOME_LAUNCHER_PATH, resolveDeclaredHomePath, resolveDesktopHomePath } from './homePath.js';
export type { DeclaredHomeApp } from './homePath.js';
/**
diff --git a/ui/packages/auth/src/LoginForm.tsx b/ui/packages/auth/src/LoginForm.tsx
index 990a9efaec7..5149a81912e 100644
--- a/ui/packages/auth/src/LoginForm.tsx
+++ b/ui/packages/auth/src/LoginForm.tsx
@@ -555,10 +555,13 @@ export function LoginForm({
}, SSO_SIGN_IN_TIMEOUT_MS);
try {
const base = window.location.pathname.replace(/\/login(?:\/.*)?$/, '');
+ // Back at the console root, which lands the person where any sign-in
+ // does: the last-used app, the declared default, the first app
+ // (objectstack#36732). The platform home page it named is retired.
const res = await fetch('/api/v1/auth/sign-in/sso', {
method: 'POST',
headers: { 'content-type': 'application/json' },
- body: JSON.stringify({ email: identifier, callbackURL: base + '/home' }),
+ body: JSON.stringify({ email: identifier, callbackURL: base + '/' }),
credentials: 'include',
signal: controller.signal,
});
diff --git a/ui/packages/auth/src/__tests__/LoginForm.test.tsx b/ui/packages/auth/src/__tests__/LoginForm.test.tsx
index 1881dfba7b2..39e978fda01 100644
--- a/ui/packages/auth/src/__tests__/LoginForm.test.tsx
+++ b/ui/packages/auth/src/__tests__/LoginForm.test.tsx
@@ -497,6 +497,23 @@ describe('LoginForm — "Sign in with SSO" with no email (objectstack#32087)', (
fetchSpy.mockRestore();
}
});
+
+ it('objectstack#36732 — the SSO round trip comes back to the console root, never the retired /home', async () => {
+ const fetchSpy = ssoFetchSpy();
+ try {
+ renderLogin(createMockClient({ features: { sso: true } }));
+ const button = await screen.findByRole('button', SSO_BUTTON);
+ fireEvent.change(screen.getByLabelText('Email'), { target: { value: 'a@corp.example' } });
+ fireEvent.click(button);
+
+ await waitFor(() => expect(fetchSpy).toHaveBeenCalledTimes(1));
+ const body = JSON.parse(String((fetchSpy.mock.calls[0][1] as RequestInit).body));
+ expect(body.callbackURL.endsWith('/')).toBe(true);
+ expect(body.callbackURL).not.toContain('/home');
+ } finally {
+ fetchSpy.mockRestore();
+ }
+ });
});
// objectstack#32432 — a refusal is mapped by `code` and `details.cause`, never by
diff --git a/ui/packages/i18n/src/locales/ar.ts b/ui/packages/i18n/src/locales/ar.ts
index c5472a46f9c..29e912685f3 100644
--- a/ui/packages/i18n/src/locales/ar.ts
+++ b/ui/packages/i18n/src/locales/ar.ts
@@ -4028,6 +4028,7 @@ const ar = {
welcomeAdminDescriptionNoAi: "أعدّ تطبيقك الأول من قائمة الإدارة على اليسار.",
noAppsTitle: "لا توجد تطبيقات بعد",
noAppsDescription: "يجري إعداد النظام — وستظهر هنا التطبيقات التي يشاركها معك المسؤول.",
+ noAppsAddDescription: "أنشئ تطبيقك الأول، أو ابدأ من قالب أو من سوق التطبيقات.",
buildWithAI: "الإنشاء بالذكاء الاصطناعي",
askAI: "اسأل الذكاء الاصطناعي",
recoveryReminder: {
diff --git a/ui/packages/i18n/src/locales/de.ts b/ui/packages/i18n/src/locales/de.ts
index 2ab22b9c54b..56ddb23eecd 100644
--- a/ui/packages/i18n/src/locales/de.ts
+++ b/ui/packages/i18n/src/locales/de.ts
@@ -3705,6 +3705,7 @@ const de = {
welcomeAdminDescriptionNoAi: "Richten Sie Ihre erste Anwendung über das Verwaltungsmenü links ein.",
noAppsTitle: "Noch keine Anwendungen",
noAppsDescription: "Das System wird eingerichtet — Apps, die Ihr Administrator für Sie freigibt, erscheinen hier.",
+ noAppsAddDescription: "Erstellen Sie Ihre erste App, oder beginnen Sie mit einer Vorlage oder dem App-Marktplatz.",
buildWithAI: "Mit KI erstellen",
askAI: "KI fragen",
recoveryReminder: {
diff --git a/ui/packages/i18n/src/locales/en.ts b/ui/packages/i18n/src/locales/en.ts
index e8218cd1567..222849b325b 100644
--- a/ui/packages/i18n/src/locales/en.ts
+++ b/ui/packages/i18n/src/locales/en.ts
@@ -4498,6 +4498,7 @@ const en = {
welcomeAdminDescriptionNoAi: 'Set up your first application from the Administration menu on the left.',
noAppsTitle: 'No applications yet',
noAppsDescription: 'The system is being set up — apps your admin shares with you will show up here.',
+ noAppsAddDescription: 'Build your first app, or start from a template or the app marketplace.',
buildWithAI: 'Build with AI',
askAI: 'Ask AI',
recoveryReminder: {
diff --git a/ui/packages/i18n/src/locales/es.ts b/ui/packages/i18n/src/locales/es.ts
index abe9ce1c6f5..9256d28badc 100644
--- a/ui/packages/i18n/src/locales/es.ts
+++ b/ui/packages/i18n/src/locales/es.ts
@@ -3787,6 +3787,7 @@ const es = {
welcomeAdminDescriptionNoAi: "Configure su primera aplicación desde el menú de Administración de la izquierda.",
noAppsTitle: "Todavía no hay aplicaciones",
noAppsDescription: "El sistema se está preparando — las aplicaciones que su administrador comparta aparecerán aquí.",
+ noAppsAddDescription: "Cree su primera aplicación, o empiece con una plantilla o el mercado de aplicaciones.",
buildWithAI: "Crear con IA",
askAI: "Preguntar a la IA",
recoveryReminder: {
diff --git a/ui/packages/i18n/src/locales/fr.ts b/ui/packages/i18n/src/locales/fr.ts
index f422a9fa515..c4b1e0139d5 100644
--- a/ui/packages/i18n/src/locales/fr.ts
+++ b/ui/packages/i18n/src/locales/fr.ts
@@ -3783,6 +3783,7 @@ const fr = {
welcomeAdminDescriptionNoAi: "Configurez votre première application depuis le menu Administration à gauche.",
noAppsTitle: "Aucune application pour l'instant",
noAppsDescription: "Le système est en cours de configuration — les applications partagées par votre administrateur apparaîtront ici.",
+ noAppsAddDescription: "Créez votre première application, ou partez d'un modèle ou de la place de marché.",
buildWithAI: "Créer avec l'IA",
askAI: "Demander à l'IA",
recoveryReminder: {
diff --git a/ui/packages/i18n/src/locales/ja.ts b/ui/packages/i18n/src/locales/ja.ts
index 2737c1f7585..414de6de12d 100644
--- a/ui/packages/i18n/src/locales/ja.ts
+++ b/ui/packages/i18n/src/locales/ja.ts
@@ -3707,6 +3707,7 @@ const ja = {
welcomeAdminDescriptionNoAi: "左の管理メニューから最初のアプリケーションを設定してください。",
noAppsTitle: "アプリケーションがまだありません",
noAppsDescription: "システムを準備中です — 管理者が共有したアプリがここに表示されます。",
+ noAppsAddDescription: "最初のアプリを作成するか、テンプレートやアプリマーケットプレイスから始めましょう。",
buildWithAI: "AI でビルド",
askAI: "AI に質問",
recoveryReminder: {
diff --git a/ui/packages/i18n/src/locales/ko.ts b/ui/packages/i18n/src/locales/ko.ts
index b1321a6b296..0ebbbb3bbfd 100644
--- a/ui/packages/i18n/src/locales/ko.ts
+++ b/ui/packages/i18n/src/locales/ko.ts
@@ -3705,6 +3705,7 @@ const ko = {
welcomeAdminDescriptionNoAi: "왼쪽 관리 메뉴에서 첫 애플리케이션을 설정하세요.",
noAppsTitle: "아직 애플리케이션이 없습니다",
noAppsDescription: "시스템을 준비하고 있습니다 — 관리자가 공유한 앱이 여기에 표시됩니다.",
+ noAppsAddDescription: "첫 앱을 만들거나, 템플릿이나 앱 마켓플레이스에서 시작하세요.",
buildWithAI: "AI로 빌드",
askAI: "AI에게 질문",
recoveryReminder: {
diff --git a/ui/packages/i18n/src/locales/pt-BR.ts b/ui/packages/i18n/src/locales/pt-BR.ts
index 6bcf30bf629..009bdea3a40 100644
--- a/ui/packages/i18n/src/locales/pt-BR.ts
+++ b/ui/packages/i18n/src/locales/pt-BR.ts
@@ -3782,6 +3782,7 @@ const pt = {
welcomeAdminDescriptionNoAi: "Configure seu primeiro aplicativo pelo menu de Administração à esquerda.",
noAppsTitle: "Ainda não há aplicativos",
noAppsDescription: "O sistema está sendo preparado — os aplicativos que seu administrador compartilhar aparecerão aqui.",
+ noAppsAddDescription: "Crie seu primeiro aplicativo ou comece com um modelo ou o marketplace de aplicativos.",
buildWithAI: "Criar com IA",
askAI: "Perguntar à IA",
recoveryReminder: {
diff --git a/ui/packages/i18n/src/locales/ru.ts b/ui/packages/i18n/src/locales/ru.ts
index db29ef6729a..d1c5dc3d121 100644
--- a/ui/packages/i18n/src/locales/ru.ts
+++ b/ui/packages/i18n/src/locales/ru.ts
@@ -3874,6 +3874,7 @@ const ru = {
welcomeAdminDescriptionNoAi: "Настройте первое приложение через меню «Администрирование» слева.",
noAppsTitle: "Приложений пока нет",
noAppsDescription: "Система настраивается — приложения, которыми поделится администратор, появятся здесь.",
+ noAppsAddDescription: "Создайте первое приложение или начните с шаблона или магазина приложений.",
buildWithAI: "Создать с помощью ИИ",
askAI: "Спросить ИИ",
recoveryReminder: {
diff --git a/ui/packages/i18n/src/locales/zh-Hans.ts b/ui/packages/i18n/src/locales/zh-Hans.ts
index 409282af881..fb6ca08800a 100644
--- a/ui/packages/i18n/src/locales/zh-Hans.ts
+++ b/ui/packages/i18n/src/locales/zh-Hans.ts
@@ -3878,6 +3878,7 @@ const zh = {
welcomeAdminDescriptionNoAi: '从左侧的「管理」菜单创建你的第一个应用。',
noAppsTitle: '还没有应用',
noAppsDescription: '系统正在准备中——管理员共享给你的应用会显示在这里。',
+ noAppsAddDescription: '搭建你的第一个应用,或者从模板、应用市场开始。',
buildWithAI: '用 AI 搭建',
askAI: '问 AI',
recoveryReminder: {
diff --git a/ui/packages/i18n/src/locales/zh-Hant.ts b/ui/packages/i18n/src/locales/zh-Hant.ts
index e0e8cc10a19..9e577ee7f82 100644
--- a/ui/packages/i18n/src/locales/zh-Hant.ts
+++ b/ui/packages/i18n/src/locales/zh-Hant.ts
@@ -3878,6 +3878,7 @@ const zhHant = {
welcomeAdminDescriptionNoAi: '從左側的「管理」選單建立你的第一個應用。',
noAppsTitle: '還沒有應用',
noAppsDescription: '系統正在準備中——管理員共享給你的應用會顯示在這裡。',
+ noAppsAddDescription: '搭建你的第一個應用,或者從模板、應用市場開始。',
buildWithAI: '用 AI 搭建',
askAI: '問 AI',
recoveryReminder: {