From 4e8f44ec25f1bdd8dc02464544fae924a5e17fd8 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 16:20:39 +0000 Subject: [PATCH 1/4] fix(app-shell): offer the header fold only with a primary to keep labelled A list with no New and no toolbar action authored variant primary handed the page header a folded face of only the overflow menu, so a long object description alone moved the page's one action into the menu at desktop width. Such a page now passes no folded face: its actions stay at every width and the description truncates. The /data page gets the same rule. Claude-Session: https://claude.ai/code/session_01ADHkmRPuiKPqavVVdijcAp Co-authored-by: Claude --- .../app-shell/src/layout/PageHeader.tsx | 4 +- .../ObjectDataPage.createAffordances.test.tsx | 33 ++++++++++++++- .../app-shell/src/views/ObjectDataPage.tsx | 6 ++- .../ObjectView.headerFold-12705.test.tsx | 41 +++++++++++++++++++ .../src/views/objectViewHeaderChrome.tsx | 8 +++- 5 files changed, 87 insertions(+), 5 deletions(-) diff --git a/ui/packages/app-shell/src/layout/PageHeader.tsx b/ui/packages/app-shell/src/layout/PageHeader.tsx index cc01e3d9fa6..f2b2303e4f5 100644 --- a/ui/packages/app-shell/src/layout/PageHeader.tsx +++ b/ui/packages/app-shell/src/layout/PageHeader.tsx @@ -135,7 +135,9 @@ export interface ConsolePageHeaderProps { * The header measures its own width, not the viewport's. The page declares * which action is primary by being the one that names it here; the header * never guesses it from `actions`. A page that passes no `foldedActions` - * keeps `actions` at every width. + * keeps `actions` at every width, and a page with no primary to keep + * labelled passes none (objectstack#33988): a face of only the `⋯` would + * trade the page's actions for its description. */ foldedActions?: React.ReactNode; /** diff --git a/ui/packages/app-shell/src/views/ObjectDataPage.createAffordances.test.tsx b/ui/packages/app-shell/src/views/ObjectDataPage.createAffordances.test.tsx index 0379071a4e6..5fd3d5ffb90 100644 --- a/ui/packages/app-shell/src/views/ObjectDataPage.createAffordances.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectDataPage.createAffordances.test.tsx @@ -61,6 +61,8 @@ import { MemoryRouter, Routes, Route } from 'react-router-dom'; let principal: Record = {}; /** Controllable server-resolved effective API operations (#3391); `undefined` = unrestricted. */ let apiOperations: string[] | undefined; +/** Whether the reader is a workspace admin (draws "Save as view"); off by default. */ +let workspaceAdmin = false; vi.mock('@object-ui/permissions', async (importOriginal) => { const actual = await importOriginal(); @@ -85,7 +87,7 @@ vi.mock('@object-ui/permissions', async (importOriginal) => { vi.mock('@object-ui/auth', async (importOriginal) => ({ ...(await importOriginal>()), useAuth: () => ({ user: { id: 'u1', name: 'Ada' }, activeOrganization: null }), - useWorkspaceAdminStatus: () => ({ isAdmin: false, isResolved: true }), + useWorkspaceAdminStatus: () => ({ isAdmin: workspaceAdmin, isResolved: true }), createAuthenticatedFetch: () => vi.fn(), })); @@ -182,6 +184,7 @@ function expectCreateEntry(expected: { rendered: boolean; disabled?: boolean }) beforeEach(() => { principal = {}; apiOperations = undefined; + workspaceAdmin = false; cleanup(); vi.stubGlobal( 'fetch', @@ -373,3 +376,31 @@ describe('#5164 — /data and the object-list page agree on one declaration', () expect(newButton()).toBeTruthy(); }); }); + +/** + * objectstack#33988 — the header's folded face (objectui#12705) keeps New + * labelled and puts Save as view in a `⋯`. With no New there is nothing to keep + * labelled, so the page offers no folded face: a long description must never + * send the page's one action into the `⋯`. The header marks a page that offers + * the fold with `data-folded`; one that does not keeps `actions` at every + * width, so the attribute is absent. + */ +describe('objectstack#33988 — /data offers the fold only with a New to keep labelled', () => { + const cluster = () => document.querySelector('[data-testid="page-header-actions"]') as HTMLElement | null; + + it('an admin who cannot create keeps "Save as view" as a button: no folded face is offered', () => { + workspaceAdmin = true; + principal = { create: false }; + renderDataPage(objects()); + expect(newButton()).toBeNull(); + expect(cluster()?.querySelector('[data-testid="object-data-save-as-view"]')).toBeTruthy(); + expect(cluster()?.hasAttribute('data-folded')).toBe(false); + }); + + it('CONTROL: with New drawn, the folded face is still offered', () => { + workspaceAdmin = true; + renderDataPage(objects()); + expect(newButton()).toBeTruthy(); + expect(cluster()?.getAttribute('data-folded')).toBe('false'); + }); +}); diff --git a/ui/packages/app-shell/src/views/ObjectDataPage.tsx b/ui/packages/app-shell/src/views/ObjectDataPage.tsx index 459af29e6b4..ba7c0bf25c8 100644 --- a/ui/packages/app-shell/src/views/ObjectDataPage.tsx +++ b/ui/packages/app-shell/src/views/ObjectDataPage.tsx @@ -629,9 +629,11 @@ export function ObjectDataPage({ dataSource, objects }: any) { } // objectui#12705 — too narrow for both actions and the description: - // New stays labelled and Save as view goes into a `⋯`. + // New stays labelled and Save as view goes into a `⋯`. With no New + // to keep labelled there is no folded face (objectstack#33988): it + // would send the page's one action into the `⋯` for the description. foldedActions={ - <> + newButton && <> {newButton} {isAdmin && ( diff --git a/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx b/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx index b1ee266de5e..55d76023323 100644 --- a/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx @@ -282,6 +282,47 @@ describe('the object list’s header folds its actions (objectui#12705)', () => }); }); +/** + * objectstack#33988 — a list that declares no primary (no New, no toolbar + * action authored `variant: 'primary'`) is offered no folded face: that face + * would keep no labelled action, so a long description alone sent the page's + * one action into the `⋯` at desktop width (hotclm's 「Launch Contract」). The + * header keeps `actions` at every width and the description truncates instead. + */ +describe('a list with no declared primary keeps its actions labelled (objectstack#33988)', () => { + const LAUNCH = { name: 'launch_contract', label: 'Launch Contract', type: 'script', locations: ['list_toolbar'] }; + /** The card's object: no New for the reader, one undeclared toolbar action, its English description. */ + const CONTRACTS = { + name: 'demo_contract', + label: 'Contract', + pluralLabel: 'Contracts', + description: + 'A contract from intake to archive: parties, commercial and legal terms, lifecycle status and the stamps each stage leaves.', + fields: { id: { type: 'text', label: 'Id' }, name: { type: 'text', label: 'Name' } }, + actions: [LAUNCH], + }; + + // A 1366 px laptop and a 1440 px desktop, each less the 256 px sidebar, and + // a tablet-wide header between the phone header and the desktop. + it.each([1110, 1184, 700])('at a %i px header the action stays a button and the header does not fold', (width) => { + headerWidth = width; + principal = { create: false }; + const { cluster, labelled, openMenu } = renderList(CONTRACTS); + expect(cluster.hasAttribute('data-folded')).toBe(false); + expect(labelled()).toEqual(['Launch Contract']); + expect(openMenu()).toEqual(['Add to favorites']); + }); + + it('CONTROL: authored `variant: primary`, the same list still folds at a 600 px header, keeping it labelled', () => { + headerWidth = 600; + principal = { create: false }; + const { cluster, labelled, openMenu } = renderList({ ...CONTRACTS, actions: [{ ...LAUNCH, variant: 'primary' }] }); + expect(cluster.getAttribute('data-folded')).toBe('true'); + expect(labelled()).toEqual(['Launch Contract']); + expect(openMenu()).toEqual(['Add to favorites']); + }); +}); + describe('declaredPrimaryToolbarAction (objectui#12705)', () => { it('is the `variant: primary` list-toolbar action with the lowest order, never the first by position', () => { const late = { ...INVITE, name: 'late', order: 5 }; diff --git a/ui/packages/app-shell/src/views/objectViewHeaderChrome.tsx b/ui/packages/app-shell/src/views/objectViewHeaderChrome.tsx index a3898274d7a..49f3150bdb2 100644 --- a/ui/packages/app-shell/src/views/objectViewHeaderChrome.tsx +++ b/ui/packages/app-shell/src/views/objectViewHeaderChrome.tsx @@ -97,6 +97,12 @@ export function useObjectViewHeaderChrome({ // it before the header can fold, so no action in the folded face carries // `autoTrigger`. Not offered on the environment list, whose toolbar is // `EnvironmentListToolbar`, not this bar. + // + // objectstack#33988 — not offered either when the list declares no + // primary (no New, no toolbar action authored `variant: 'primary'`): that + // face would keep no labelled action, so a long description alone would + // send the page's one action into the `⋯`. Without a folded face the + // header keeps `actions` at every width and the description truncates. const toolbarRowActions: UIActionSchema[] = listActions?.some((a: { locations?: readonly string[] }) => a.locations?.includes('list_toolbar')) ? toolbarActionsWithDeepLink : []; @@ -133,7 +139,7 @@ export function useObjectViewHeaderChrome({ maxVisible: 0, mobileMaxVisible: 0, }; - const foldedHeaderActions = !isEnvironmentList ? ( + const foldedHeaderActions = !isEnvironmentList && (showCreate || primaryToolbarAction) ? ( <> {createButton} {/* One inline slot at every width: `toolbarBar` keeps none below From 5ee787e29db6988e810ef3874184c3cfabe4c19c Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 16:23:15 +0000 Subject: [PATCH 2/4] chore(changeset): header fold needs a declared primary Claude-Session: https://claude.ai/code/session_01ADHkmRPuiKPqavVVdijcAp Co-authored-by: Claude --- .changeset/33988-header-fold-needs-primary.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .changeset/33988-header-fold-needs-primary.md diff --git a/.changeset/33988-header-fold-needs-primary.md b/.changeset/33988-header-fold-needs-primary.md new file mode 100644 index 00000000000..b6630f8b95d --- /dev/null +++ b/.changeset/33988-header-fold-needs-primary.md @@ -0,0 +1,11 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/console': patch +--- + +fix(console): a list page with no declared primary action keeps its header actions as buttons, whatever the length of the object's description + +Clause-②: no +Metadata-protocol: none + +On a list page the header folds its actions when they do not fit beside the title and the object's description: the primary action stays a labelled button and the others move into the `⋯` menu. The primary is declared: the page's New, else the list-toolbar action authored `variant: 'primary'`. A list with neither had nothing to keep labelled, so the folded header was the `⋯` alone, and a long description by itself moved the page's one action (for example a reader without create rights and a single `Launch Contract` toolbar action) into the menu at desktop width. Such a list is now offered no folded header: its actions stay buttons at every width and the description is truncated instead. The `/data` page follows the same rule: with no New to keep, Save as view stays a button. A list that declares a primary folds exactly as before. To keep a toolbar action labelled on a narrow header as well, author it `variant: 'primary'`. From 1eba7d1e785f621263b310d18e6203a2f36ebeb4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 16:24:19 +0000 Subject: [PATCH 3/4] test(app-shell): read the action before the fold marker in the no-primary pins Claude-Session: https://claude.ai/code/session_01ADHkmRPuiKPqavVVdijcAp Co-authored-by: Claude --- .../app-shell/src/views/ObjectView.headerFold-12705.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx b/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx index 55d76023323..df1f9a1b9a3 100644 --- a/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx @@ -308,9 +308,9 @@ describe('a list with no declared primary keeps its actions labelled (objectstac headerWidth = width; principal = { create: false }; const { cluster, labelled, openMenu } = renderList(CONTRACTS); - expect(cluster.hasAttribute('data-folded')).toBe(false); expect(labelled()).toEqual(['Launch Contract']); expect(openMenu()).toEqual(['Add to favorites']); + expect(cluster.hasAttribute('data-folded')).toBe(false); }); it('CONTROL: authored `variant: primary`, the same list still folds at a 600 px header, keeping it labelled', () => { From 2daa61df141105c8faaa17d22030c32c5c85fcbb Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 16:51:07 +0000 Subject: [PATCH 4/4] test(app-shell): pay the lint load at collection in the header fold harness Claude-Session: https://claude.ai/code/session_01ADHkmRPuiKPqavVVdijcAp Co-authored-by: Claude --- .../app-shell/src/views/ObjectView.headerFold-12705.test.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx b/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx index df1f9a1b9a3..8ed1a04797f 100644 --- a/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx +++ b/ui/packages/app-shell/src/views/ObjectView.headerFold-12705.test.tsx @@ -99,6 +99,9 @@ vi.mock('@object-ui/plugin-grid', async (importOriginal) => ({ ImportWizard: ({ open }: { open: boolean }) => (open ?
: null), })); +// `ObjectView` reaches a dynamic `import('@objectstack/lint')`: pay its load at +// collection, never inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; import { ObjectView, declaredPrimaryToolbarAction } from './ObjectView'; import { ExpressionProvider } from '../providers/ExpressionProvider';