Skip to content

Commit bf594eb

Browse files
fix(app-shell): a list view's navigation.preventNavigation opens no record and draws no link face (#34161)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9N6w1Woebt4XY39p5txohNf)_ Fixes #33549 Clause-②: no — an authored key starts being honoured; no surface added Metadata-protocol: none ## 维护者速读 - 改了什么:Console 对象列表(桌面)在视图写了 `navigation.preventNavigation: true` 时,按 `mode: 'none'` 处理:点行不再打开抽屉(不写 `?recordId=`),⌘/Ctrl/中键也不开新标签页;首列不再画成记录链接,右键菜单不再有「打开」。 - 为什么改:spec 对这个键的说明是「完全禁用标准导航」,而 Console 列表此前根本不读它,作者设了也无效。其他宿主(grid、看板、日历、甘特、地图、时间线、树、plugin-view 的 ObjectView)早已遵守。 - 风险与回滚:只影响写了 `preventNavigation: true` 的视图;没写或写 `false` 的视图行为不变(对照 pin 钉住)。手机端不变。回滚即还原 `objectViewRecordNavigation.ts` 中新增的一行。 - 先看:`ui/packages/app-shell/src/views/objectViewRecordNavigation.ts`(`detailNavigation` 里新增的 `preventNavigation` 一行,在手机分支之后);`ui/packages/app-shell/src/views/ObjectView.rowOpensNothing-33317.test.tsx`(新增的 objectstack#33549 describe)。 - 两分钟验证:`pnpm --dir ui exec vitest run packages/app-shell/src/views/ObjectView.rowOpensNothing-33317.test.tsx`,预期 15/15 通过。 - 需要你做的:无,席位落地。 ## What changes `useObjectViewRecordNavigation` (`detailNavigation`) now resolves a view whose authored navigation carries `preventNavigation: true` to `{ mode: 'none' }`, after the phone branch and before any authored mode is read. Everything downstream already keys on that resolved mode, so the one line folds the flag into every reader at once: - `handleRowClick` returns on `none`: a plain click writes no `?recordId=`, and a ⌘, Ctrl or middle click opens no tab (the console's own `none` rule). - `rowOpensRecord: navOverlay.mode !== 'none'` (`ObjectView`) is `false`, so the grid draws the record-link column as plain text and the right-click menu offers no Open items. The row's `list_item` actions stay. - The row's `↗` (open as page) and the reader's Open records preference are drawer-only, so they are not offered either. Hosts measured (who reads `navigation.preventNavigation` on `main` at `385ea1cc`): | Host | Before | This PR | |:--|:--|:--| | Console object list, `@object-ui/app-shell` `ObjectView` via `objectViewRecordNavigation.ts` | ignored on `drawer` (opened the drawer); a `page` view's plain click was already inert through `useNavigationOverlay`, but its link face, Open items and modifier-click tab stayed | **changed**: resolves to `none` | | `@object-ui/plugin-view` `ObjectView` `handleRowClick` | honoured, modifier click included | unchanged | | `@object-ui/plugin-grid` `ObjectGrid` (`opens` in the row context menu) | honoured | unchanged | | `useNavigationOverlay` (`@object-ui/react`): kanban, calendar, gantt, map, timeline, tree | honoured (each has a pin) | unchanged | | `ObjectDataPage` | reads no view navigation: hard-codes `{ mode: 'drawer' }` | unchanged (no authored view on that page) | | `InterfaceListPage` | reads the page's `recordAction`, not the source view's `navigation` block (it ignores the view's `mode` too) | unchanged | Phone face (out of scope, measured, not changed): on a phone, `detailNavigation` answers `deriveRecordSurface(objectDef, { viewport: 'mobile' })` before reading anything authored. A throwaway hook probe on head `2b09572e` (deleted, not committed) gave, for a view `{ mode: 'drawer', preventNavigation: true }`: phone ⇒ resolved mode `page`, and a row tap calls `navigate('record/r-2')` (the record page opens); desktop ⇒ resolved mode `none`, no navigate and no search-param write. Whether a phone tap should honour an authored "no navigation" is the open maintainer decision #33719. Docs: `content/docs/frontend/plugins/plugin-grid.mdx` and `plugin-list.mdx` (which name the console's `rowOpensRecord={false}` cases) and `plugin-view.mdx` (the Console's record drawer section) now say the flag resolves the same way. ## Tests New top-level `describe` in the existing harness `ObjectView.rowOpensNothing-33317.test.tsx` (real `ObjectView`, real `ListView` grid; a `LocationProbe` added beside the list route reads `?recordId=`). No forced test edits: the harness's `mountList` / `objectsWith` take a widened `navigation` type and the route element gains the probe; every pre-existing case is unchanged and green. - `drawer` + `preventNavigation: true`: a plain row click writes no `?recordId=` and stays on the list, no tab. - the same: ⌘ / Ctrl / middle click opens no tab. - the same: name cell plain text, no `primary-field-link`, right-click menu has no Open items, keeps Revoke. - `page` + `preventNavigation: true`: no link face; a click stays on the list. - CONTROL: `drawer` + `preventNavigation: false`: link face, and a row click writes `?recordId=c1`. - CONTROL: `drawer` with the flag absent: a row click writes `?recordId=c1`. <details><summary>Red-first, green, ablation</summary> - Red-first (pins on `385ea1cc` code, before the fix): `Tests 4 failed | 11 passed (15)`; the four new non-CONTROL cases failed, both CONTROLs passed. - Green on `2b09572e`: the harness plus the three neighbouring record-navigation files (`ObjectView.cardFacesOpenNothing-33548`, `objectViewRecordNavigation.listRows-27524`, `objectViewRecordNavigation.phonePush-29074`): `Test Files 4 passed (4) · Tests 42 passed (42)`. - Ablation (committed fix first, `node scripts/ablation-replace.mjs --delete` of the anchor `if (authored?.preventNavigation) return { mode: 'none' };`): `anchor 1 -> 0, blob e05a3a1 -> 078c53e3487d`, run `Tests 4 failed | 11 passed (15)` (the same four), restore blob `e05a3a1b…` = HEAD blob, `git diff HEAD` empty. The tests import the module by relative path (source, no `dist/`), so no rebuild leg applies. </details> ## Acceptance notes - A `?recordId=` link opened on a list whose view resolves to `none` (authored `none`, and now `preventNavigation: true`) still opens the drawer through the URL-sync effect: only a list-only object (`servesRecordRead`) refuses the link. This PR keeps `preventNavigation` identical to an authored `none`, so it changes nothing there; whether a deep link should open a record on a view that opens none is not asked by this card. carrier: none — noted, not filed. ## Verification Local, on head `99e3217b` (after the last commit): - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 69 commands derived from the 6 changed paths. All 69 ran under `scripts/pm/os-verify-lock.sh`, each exit captured before any pipe; 69 exited 0. `pnpm --filter @objectstack/spec run check:skill-examples` first exited 3 (PREREQUISITE NOT MET: `packages/client-react/dist` had no `.d.ts`); after `pnpm --filter @objectstack/client build && pnpm --filter @objectstack/client-react build` it exited 0 (`346 prose examples type-check across 3 surface(s)`). - `dispatch-gates --ran` over the exit-coded record: `69 derived famil(ies) accounted for — 69 run, 0 NOT-MEASURED (a DERIVED zero — all 69 recorded an exit code and none of them is 3)`. - `pnpm --filter @object-ui/app-shell run type-check` (`tsc --noEmit` and `tsc -p tsconfig.test.json`): exit 0. - Declared narrowing: `pnpm --dir ui exec vitest run packages/app-shell/` (2,272 test files at `--maxWorkers=2`) had not finished after 55 minutes on the shared box and was stopped by its own PIDs, no verdict read. Narrowed to the 94 test files under `ui/packages/app-shell/src` and `ui/apps/console/src` that mount the console `ObjectView` or import `objectViewRecordNavigation`: `Test Files 94 passed (94) · Tests 803 passed (803)`. The whole package runs in CI's Test UI shards. - Lint, Type Check UI, Test UI, Build & E2E UI and the rest of the farm: CI's, read from this PR's check-runs. --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmT9Ghpj4eKCvRNGkfZ)_ --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent 2539ad9 commit bf594eb

6 files changed

Lines changed: 104 additions & 10 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/console': patch
4+
---
5+
6+
fix(app-shell): a list view authored `navigation.preventNavigation: true` opens no record and draws no link face
7+
8+
Clause-②: no — an authored key starts being honoured; no surface added
9+
Metadata-protocol: none
10+
11+
The spec describes `navigation.preventNavigation` as "Disable standard navigation entirely". The Console's object list did not read it: a `drawer` view with the flag still opened the record drawer on a row click (it wrote `?recordId=`), and a ⌘, Ctrl or middle click still opened the record in a new tab. Its rows also kept their link face: the first column drew as the record link and the right-click menu offered Open and Open in new tab.
12+
13+
On a desktop, the Console's object list now resolves such a view the way it resolves a view authored `navigation: { mode: 'none' }`, whatever mode the view names. A row click opens nothing, a modifier click included. The record-link column draws plain text, and the right-click menu offers no Open items. The row's actions stay. A view without the flag, or with `preventNavigation: false`, opens its records as before. On a phone the list is unchanged: a tap still opens the record's page.

‎content/docs/frontend/plugins/plugin-grid.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ On a phone, where the grid draws each row as a card, the card draws no pointer
297297
and no hover wash, and its "⋮" stays (objectstack#33548). Absent (or `true`),
298298
every row is drawn as before. It is a host prop, not a
299299
schema key: list metadata cannot set it. The console passes `false` for a view
300-
authored `navigation: { mode: 'none' }` and for an object whose data API serves
300+
authored `navigation: { mode: 'none' }` or `navigation.preventNavigation: true`
301+
(whatever its mode, objectstack#33549) and for an object whose data API serves
301302
no single-record read (objectstack#33317).
302303

303304
### Inline Editing

‎content/docs/frontend/plugins/plugin-list.mdx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ and the grid's phone cards, the gallery's cards and a board card that cannot be
6767
dragged draw no pointer and no hover lift. The click still reaches
6868
`onRowClick`, and row and card actions stay. Absent (or `true`), nothing
6969
changes. It is a host prop, not a schema key: list metadata cannot set it. The
70-
console passes `false` for a view authored `navigation: { mode: 'none' }` and
71-
for an object whose data API serves no single-record read (objectstack#33317,
72-
objectstack#33548).
70+
console passes `false` for a view authored `navigation: { mode: 'none' }` or
71+
`navigation.preventNavigation: true` (whatever its mode) and for an object whose
72+
data API serves no single-record read (objectstack#33317, objectstack#33548,
73+
objectstack#33549).
7374

7475
## Status
7576

‎content/docs/frontend/plugins/plugin-view.mdx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,9 @@ stay as they are, and ⤡ or `Esc` restores it. The full page opens from a row's
523523
↗, or from 「Open as full page」, the last host item of the record header's
524524
`⋯`. 「Collapse to drawer」 on that page returns to the list only when the ↗
525525
opened it. None of this is declared in metadata: `navigation.mode` still
526-
decides only whether a record opens in the drawer at all.
526+
decides only whether a record opens in the drawer at all, and a view authored
527+
`navigation.preventNavigation: true` opens no record on a row click, whatever
528+
its mode, a Cmd/Ctrl or middle click included (objectstack#33549).
527529

528530
## CRUD Operations
529531

‎ui/packages/app-shell/src/views/ObjectView.rowOpensNothing-33317.test.tsx‎

Lines changed: 77 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
* CONTROL: a row that opens (the default drawer, an authored `page`) keeps
2424
* its link and its Open item. objectstack#33548: an authored `none` row opens
2525
* nothing on a ⌘, Ctrl or middle click either; a row that opens still does. The bare data page (`ObjectDataPage`) routes
26-
* its own row clicks, so its list-only face is pinned too.
26+
* its own row clicks, so its list-only face is pinned too. objectstack#33549:
27+
* a view authored `navigation.preventNavigation: true` resolves the same way
28+
* whatever its mode, with the same `drawer` view minus the flag as CONTROL.
2729
*
2830
* The record body is not what this file reads, so `RecordDetailView` is a
2931
* null sink.
@@ -32,7 +34,7 @@
3234
import * as React from 'react';
3335
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
3436
import { render, cleanup, screen, fireEvent, waitFor, within, act } from '@testing-library/react';
35-
import { MemoryRouter, Routes, Route } from 'react-router-dom';
37+
import { MemoryRouter, Routes, Route, useLocation } from 'react-router-dom';
3638
import { createI18n, I18nProvider } from '@object-ui/i18n';
3739
import { MePermissionsProvider, type MePermissionsAuthenticatedResponse } from '@object-ui/permissions';
3840

@@ -86,8 +88,11 @@ const ROWS = [
8688
{ id: 'c2', connection: 'azure-prod', token_prefix: 'scim_cd34' },
8789
];
8890

91+
/** A list view's authored `navigation` block, as these cases write it. */
92+
type AuthoredNavigation = { mode?: string; preventNavigation?: boolean };
93+
8994
/** The object, its one list view carrying `navigation` when given. */
90-
function objectsWith(navigation?: { mode: string }) {
95+
function objectsWith(navigation?: AuthoredNavigation) {
9196
return [
9297
{
9398
name: OBJECT_NAME,
@@ -191,7 +196,18 @@ function withProviders(apiOperations: string[] | undefined, children: React.Reac
191196
);
192197
}
193198

194-
async function mountList(opts: { apiOperations?: string[]; navigation?: { mode: string } }) {
199+
/** The list route's query string, drawn where a case can read it: the drawer's `?recordId=` lands here. */
200+
function LocationProbe() {
201+
const { search } = useLocation();
202+
return <output data-testid="list-search">{search}</output>;
203+
}
204+
205+
/** The record the drawer's `?recordId=` names on the list route, or `null`. */
206+
function drawerRecordId(): string | null {
207+
return new URLSearchParams(screen.getByTestId('list-search').textContent ?? '').get('recordId');
208+
}
209+
210+
async function mountList(opts: { apiOperations?: string[]; navigation?: AuthoredNavigation }) {
195211
const objects = objectsWith(opts.navigation);
196212
window.history.replaceState(null, '', LIST_PATH);
197213
render(
@@ -201,7 +217,12 @@ async function mountList(opts: { apiOperations?: string[]; navigation?: { mode:
201217
<Routes>
202218
<Route
203219
path="/apps/:appName/:objectName/view/:viewId"
204-
element={<ObjectView dataSource={dataSourceFor(objects)} objects={objects} onEdit={() => {}} />}
220+
element={(
221+
<>
222+
<ObjectView dataSource={dataSourceFor(objects)} objects={objects} onEdit={() => {}} />
223+
<LocationProbe />
224+
</>
225+
)}
205226
/>
206227
<Route path="*" element={<div data-testid="left-the-list" />} />
207228
</Routes>
@@ -339,3 +360,54 @@ describe('objectstack#33317 — the bare data page: a list-only object\'s rows d
339360
expect(looksLikeALink('okta-staging')).toBe(true);
340361
});
341362
});
363+
364+
describe('objectstack#33549 — the console object list: `navigation.preventNavigation: true` opens no record, whatever the mode', () => {
365+
const PREVENTED_DRAWER = { mode: 'drawer', preventNavigation: true };
366+
367+
it('a `drawer` view with `preventNavigation: true`: a row click writes no `?recordId=` and stays on the list', async () => {
368+
await mountList({ navigation: PREVENTED_DRAWER });
369+
fireEvent.click(screen.getByText('scim_ab12'));
370+
fireEvent.click(screen.getByText('okta-staging'));
371+
expect(drawerRecordId()).toBeNull();
372+
expect(screen.queryByTestId('left-the-list')).toBeNull();
373+
expect(openSpy).not.toHaveBeenCalled();
374+
});
375+
376+
it('…nor does a ⌘, Ctrl or middle click open a new tab', async () => {
377+
await mountList({ navigation: PREVENTED_DRAWER });
378+
fireEvent.click(screen.getByText('scim_ab12'), { metaKey: true });
379+
fireEvent.click(screen.getByText('scim_ab12'), { ctrlKey: true });
380+
fireEvent.click(screen.getByText('scim_ab12'), { button: 1 });
381+
expect(openSpy).not.toHaveBeenCalled();
382+
expect(drawerRecordId()).toBeNull();
383+
});
384+
385+
it('…and the row draws no link face: the name cell is plain text, and the right-click menu has no Open but keeps Revoke', async () => {
386+
await mountList({ navigation: PREVENTED_DRAWER });
387+
expect(looksLikeALink('okta-staging')).toBe(false);
388+
expect(screen.queryAllByTestId('primary-field-link')).toHaveLength(0);
389+
const menu = await contextMenuOf('scim_ab12');
390+
expect(menu.ids.filter((id) => OPEN_ITEMS.includes(id ?? ''))).toEqual([]);
391+
expect(menu.labels).toContain('Revoke');
392+
});
393+
394+
it('a `page` view with `preventNavigation: true` draws no link face either', async () => {
395+
await mountList({ navigation: { mode: 'page', preventNavigation: true } });
396+
expect(looksLikeALink('okta-staging')).toBe(false);
397+
fireEvent.click(screen.getByText('scim_ab12'));
398+
expect(screen.queryByTestId('left-the-list')).toBeNull();
399+
});
400+
401+
it('CONTROL — the same `drawer` view with `preventNavigation: false`: a row click writes `?recordId=`, and the name cell is the record link', async () => {
402+
await mountList({ navigation: { mode: 'drawer', preventNavigation: false } });
403+
expect(looksLikeALink('okta-staging')).toBe(true);
404+
fireEvent.click(screen.getByText('scim_ab12'));
405+
await waitFor(() => expect(drawerRecordId()).toBe('c1'));
406+
});
407+
408+
it('CONTROL — the same `drawer` view with the flag absent: a row click writes `?recordId=`', async () => {
409+
await mountList({ navigation: { mode: 'drawer' } });
410+
fireEvent.click(screen.getByText('scim_ab12'));
411+
await waitFor(() => expect(drawerRecordId()).toBe('c1'));
412+
});
413+
});

‎ui/packages/app-shell/src/views/objectViewRecordNavigation.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ export function useObjectViewRecordNavigation({
195195
// answers `page` whatever the view or the object declares.
196196
if (phone) return { mode: deriveRecordSurface(objectDef, { viewport: 'mobile' }) };
197197
const authored = activeView?.navigation ?? objectDef.navigation;
198+
// `preventNavigation: true` ("Disable standard navigation
199+
// entirely") outranks every mode: the row resolves to `none`, so
200+
// no click opens it, a modifier click included, and the list
201+
// draws no link face for it (`rowOpensRecord`, objectstack#33549).
202+
if (authored?.preventNavigation) return { mode: 'none' };
198203
if (authored) {
199204
// Authored config wins. For an overlay, resolve the `size`
200205
// bucket to a viewport-clamped width when no explicit width was

0 commit comments

Comments
 (0)