Skip to content

Commit 9aabb7e

Browse files
fix(app-shell): the record page draws the record the server served to a pending approver with no object read (#39739)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6Jao6b3sg9unxpwCQHMkkc6XxT)_ Fixes #39709 Clause-②: no Metadata-protocol: none ## 维护者速读 - 待审批的审批人即使没有这类单据的查看权限,从审批里打开那条单据时,单据页现在会显示系统已经给他的标题和字段,不再是只有编号的空白页;其他人和其他页面看到的不变。 - 属于审批流程:把「待审期间审批人可以查看这一条单据」这条已有裁决补到单据页上(请求页那一半已经合入)。 - 审批人看到的只是服务端按他的权限过滤后给出的内容,编辑、删除、导出照旧不可用;万一有问题,直接撤回这个改动即恢复原样。 - 无 ## What changes `RecordDetailView` (the record page) now draws the row the server served when both of these hold, and only then: 1. the record is held for this route (the data API answered the read of this record id), and 2. the loaded `/auth/me/permissions` answer grants no `read` on the page's object. That is the pending approver whose read comes from the approval (rulings 6429330267 on #26180 and 7402324742 on #39485, applied by the decision reading 7419067633 on #39709). Under those two conditions: - the page row (`readablePageRecord`, which feeds the title, the breadcrumb and `RecordContext.data`) is the served row as served, instead of the row folded through the client's field mirror (`readableRow`), which stripped every field for an object the answer does not name; - the page body reads under `ServerReadScope` naming **only the page's own object**, so the blocks' `check(object, 'read')` / `checkField(object, field, 'read')` answer "allowed" for that object, for that page. Kept exactly as before: - every other verdict: `create` / `update` / `delete` / `export`, field `write` / `create`, `getFieldPermissions`, `effectiveObjects`. The header Edit/Delete gates, inline edit and actions read the enclosing answer (computed above the scope); - related lists: which children are drawn is decided with the enclosing answer (`canOnObject`, above the scope), and the scope names no child object; - drawers stacked over the page (`RecordPageDrawerHost` renders them beside the page tree, outside the scope) and every other page; - a reader whose answer grants the read: no scope object, the field mirror unchanged; - a record the server did not serve (stranger, or the approver after deciding): no row, so no scope object; not-found / access-ended states unchanged. Keyed on the server's answer only (row held + answer silent), never on a client reading of who approves what. No change to `ServerReadScope.tsx`, `AppContent.tsx`, the permissions endpoint or spec. The scope element is mounted on every record page, with an empty object list unless both conditions hold, so the page tree keeps its shape: a conditional wrapper would remount every block of the page when the read lands and again on every re-read (the record-load effect passes through `loading`). With no object named it changes no verdict. ## Tests New top-level block `RecordDetailView.approverServedRow-39709` in `RecordDetailView.harness.test.tsx` (the component's shared harness), real record page under a real `MePermissionsProvider`: - approver (answer names another object only), row served: H1 is the served title and the served field value is drawn; - same reader: no Edit in the header toolbar; - CONTROL: reader whose answer names the object with a field `readable: false`, on a backend that does not strip (the field rides the row): the field stays off the page, and Edit is present (which also proves the Edit probe sees the button); - CONTROL: row not served: `record-not-found`. Red first on `origin/main` 3adf532 (commit 65e526e): approver cases red (`expected 'Contract CT-1' to contain 'Supply contract'`), controls green. <details><summary>Ablations (each restored from the commit, `git status --porcelain` empty after)</summary> - scope given no object (row bypass kept): 2 red, `expected 'ContractSupply contractCommentsDetail…' to contain 'Net 30 days'` (title drawn, fields not): the mount is load-bearing for the body; - row bypass removed (scope kept): 2 red, `expected 'Contract CT-1' to contain 'Supply contract'`: the bypass is load-bearing for the title; - the no-read guard removed: the named-reader CONTROL goes red, `expected 'ContractSupply contractCommentsEditDe…' not to contain 'Merger planned'`: the scope never reaches a reader whose answer grants the read. </details> <details><summary>Local runs</summary> - `vitest run packages/app-shell/src/views/RecordDetailView` (all 104 files): 905 passed; - `vitest run packages/app-shell/src/console packages/app-shell/src/views/recordDrawerStack packages/app-shell/src/views/approval-decision`: 313 files, 2724 passed; - after merging `origin/main` (which brought #39736): `RecordDetailView.harness`, `approval-decision`, `RecordDetailView.approval*`: 17 files, 267 passed; - `pnpm --filter @object-ui/app-shell type-check` (both tsconfigs): exit 0. The whole `@object-ui/app-shell` suite was not run locally (over the container's foreground limit): CI `Test UI`. </details> ## Acceptance notes - Server-side pin not in this PR's file surface: no test on `main` pins a field hidden by field-level security staying stripped on the approval-admitted read (the decision reading's ADR-0124 D5 item). This page draws what was served, so that strip is the server's guarantee; carrier: the seat. - Under the scope the client's field read mirror is off for the page's object, explicit `readable: false` entries included (as `ServerReadScope` documents); the boundary is the server's masker. - Lookup display names for the approver: the record read's `$expand` is still field-gated by the enclosing answer before the row arrives, so for this reader it expands nothing and lookups draw their ids. Not changed here (it would ask the server for more before knowing the read is admitted). - An authored page block inside the scope that lists the page's own object (a self-referencing related list placed by the page itself) would ask `check` under the scope; the data API confines that read to the vouched record ids. The default related-list derivation is unaffected (decided above the scope). - ApprovalRecordReads (`AppContent.tsx`) and the record page's own-object scope (`serverReadsRecord`) now overlap on the approval request record page's own row; ApprovalRecordReads stays load-bearing for the Timeline (`sys_approval_action`) and for request reads on other objects' pages. Follow-up: decide whether the request page's own-row half of ApprovalRecordReads is redundant; not removed here. - The served row also feeds declared-action `visible` predicates: an action whose predicate reads a field can now show to an approver with no client read on the object. Permission verdicts (update, delete…) are unchanged and the server refuses the write. - Rework (L1-b 7421035995): the objectui#13324 console control is rewritten for the new rule (page draws its served row; no edit control; the `sys_approval_action` Timeline draws no rows without ApprovalRecordReads, ablation-proven), not skipped or deleted. ## Verification Risk-ordered first reads: `RecordDetailView.tsx` hunk at `serverReadsRecord` (the two conditions), then the `pageTree` mount, then the harness block. Two-minute check: `cd ui/packages/app-shell && pnpm exec vitest run --root ../.. packages/app-shell/src/views/RecordDetailView.harness.test.tsx -t approverServedRow`: 4 passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L9qibvMXrDPhCt3pGziYWE <!-- signed: repo:objectstack@os-tesla · os-tesla · session_01L9qibvMXrDPhCt3pGziYWE --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 791e151 commit 9aabb7e

4 files changed

Lines changed: 255 additions & 19 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@object-ui/app-shell": patch
3+
---
4+
5+
fix(app-shell): the record page draws the record the server served to a pending approver with no object read
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A pending approver may read the one record an approval request is about while their step waits, even without read on its object. The server served that record, but the record page showed only its id: the console's permissions answer grants no read on the object, so the page hid the title and every field the server had already filtered for this reader.
11+
12+
The record page now draws the served record when two things hold: the server answered the read of this record, and the loaded permissions answer grants no read on its object. Only that page's reads of that object are left to the server. Edit, delete, inline editing, export and actions stay gated as before, related lists of other objects and every other page are unchanged, and a reader whose answer grants the read keeps today's field-level hiding (objectstack#39709).

‎ui/apps/console/src/services/approvalRequestsDataSource.servedPageMemberPermissions-13324.test.tsx‎

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,17 @@
1919
* (objectstack-ai/objectstack#25228).
2020
*
2121
* The control mounts the same page through the routed adapter WITHOUT
22-
* `ApprovalRecordReads`, under the same answer, and pins that blank page: it is
23-
* what proves the member answer here is one that strips, so the first test can
24-
* only pass because `ApprovalRecordReads` scopes the field-read gate.
22+
* `ApprovalRecordReads`, under the same answer. Since objectstack#39709 the
23+
* record page itself leaves the reads of its OWN object to the server once the
24+
* server served the row and the answer grants no read on it, so the request's
25+
* own fields are drawn there too. What the control pins is what only
26+
* `ApprovalRecordReads` opens: the Timeline, a related list of the other
27+
* approval object (`sys_approval_action`), draws no row without it. That is
28+
* what proves the member answer here is one that strips, so the Timeline test
29+
* can only pass because `ApprovalRecordReads` scopes the read gate.
2530
*/
2631
import { describe, it, expect, vi, afterEach } from 'vitest';
27-
import { render, screen, cleanup, fireEvent, within, waitFor } from '@testing-library/react';
32+
import { render, screen, cleanup, fireEvent, within, waitFor, act } from '@testing-library/react';
2833
import { MemoryRouter, Routes, Route } from 'react-router-dom';
2934
import type { ReactNode } from 'react';
3035

@@ -328,28 +333,37 @@ describe('the served request page for a non-admin approver, under the real MePer
328333
fireEvent.click(tab);
329334
expect(await screen.findByText('Budget checked', undefined, { timeout: 8000 })).toBeTruthy();
330335
expect(screen.getByText('Please review the laptop order')).toBeTruthy();
336+
// The rows came from the actions route, not the data API.
337+
expect(timelineGets().length).toBeGreaterThan(0);
331338
});
332339

333-
it('control: the same answer strips the served row to its id when the routed reads are mounted without ApprovalRecordReads', async () => {
340+
it("control: without ApprovalRecordReads the page draws its own served row (objectstack#39709), and the Timeline's other approval object stays dark", async () => {
334341
openAsMember(routedReadsOnly);
335-
// The page is up and the approvals get answered: the tab strip is drawn
336-
// and the heading names the request by its object label and id, the
337-
// title's last rung, as the blank page the report describes does.
338342
await screen.findByRole('tab', { name: /Details/ }, { timeout: 8000 });
339343
await waitFor(() => expect(requestGets().length).toBeGreaterThan(0), { timeout: 8000 });
340-
await screen.findByRole('heading', { level: 1, name: /^Approval Request req_/ }, { timeout: 8000 });
341-
expect(screen.queryByTestId('declared-action-approval_approve')).toBeNull();
342-
expect(screen.queryByTestId('declared-action-approval_reject')).toBeNull();
343-
expect(pageText()).not.toContain('Invoice Approval');
344-
expect(pageText()).not.toContain('Manager Review');
344+
// The record page leaves the reads of ITS OWN object to the server once
345+
// the server served the row and the answer grants no read on it
346+
// (objectstack#39709, rulings on objectstack#26180 and #39485): the
347+
// request's own fields are drawn without the console's scope.
348+
await screen.findByRole('heading', { level: 1, name: 'Invoice Approval' }, { timeout: 8000 });
349+
expect(pageText()).toContain('Manager Review');
350+
// Reads only: the scope moves no write verdict, so the page offers no
351+
// edit control for the request (header Edit, nor an inline-edit pencil).
352+
expect(screen.queryByRole('button', { name: /^Edit$/ })).toBeNull();
353+
expect(screen.queryByRole('menuitem', { name: /^Edit$/ })).toBeNull();
354+
expect(document.querySelector('[data-record-page-root] svg.lucide-pencil')).toBeNull();
355+
// ...but nothing else: `sys_approval_action` is another object, which the
356+
// member may not read by the data API's answer, so the Timeline draws no
357+
// row. Only `ApprovalRecordReads` opens it (the Timeline test above).
345358
const tab = screen.getByRole('tab', { name: /Timeline/ });
346359
fireEvent.mouseDown(tab);
347360
fireEvent.click(tab);
348361
await waitFor(() => expect(tab.getAttribute('aria-selected')).toBe('true'), { timeout: 8000 });
349-
// The member may not read `sys_approval_action` by the data API's answer,
350-
// so the Timeline's related list is not drawn and never reads the route.
351-
expect(timelineGets()).toEqual([]);
362+
await act(async () => {
363+
for (let i = 0; i < 20; i++) await new Promise((r) => setTimeout(r, 0));
364+
});
352365
expect(pageText()).not.toContain('Budget checked');
366+
expect(pageText()).not.toContain('Please review the laptop order');
353367
});
354368
});
355369

‎ui/packages/app-shell/src/views/RecordDetailView.harness.test.tsx‎

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4220,3 +4220,180 @@ describe('RecordDetailView.closedLock-37773', () => {
42204220
expect(await overflowItems()).toContain('Delete');
42214221
});
42224222
});
4223+
4224+
// ── RecordDetailView.approverServedRow-39709 ────────────────────────────────
4225+
4226+
/**
4227+
* objectstack#39709 — a pending approver with no object read opens the record
4228+
* the request is about, and the record page draws the row the server served.
4229+
*
4230+
* The server admits that one read while the approver's step waits (the rulings
4231+
* on objectstack#26180 and objectstack#39485): the data API answers the record,
4232+
* stripped by the reader's own field rules. `/auth/me/permissions` describes
4233+
* the data API's standing rule, so it names no read on the object, and the
4234+
* page's two read mirrors (`check(object, 'read')`, `checkField(object, field,
4235+
* 'read')`) failed closed: no title, no field, a blank page for a record the
4236+
* server had just served.
4237+
*
4238+
* What is pinned, through the real record page and the real
4239+
* `MePermissionsProvider`:
4240+
*
4241+
* - the served row's title and fields are drawn when the answer grants no
4242+
* read on the object and the row was served;
4243+
* - writes stay gated: no Edit in the header for that reader;
4244+
* - CONTROLS: a reader whose answer names the object keeps today's field
4245+
* mirror (a field it denies stays off the page, even when served), and a
4246+
* record the server did not serve keeps the not-found state.
4247+
*
4248+
* Direction, written before the run: on `main` the approver case is RED (no
4249+
* title, no field) and every control is GREEN.
4250+
*/
4251+
4252+
describe('RecordDetailView.approverServedRow-39709', () => {
4253+
restoreAfterBlock();
4254+
4255+
const OBJECT = 'os_39709_contract';
4256+
const REC = 'CT-1';
4257+
const objectDef = {
4258+
name: OBJECT,
4259+
label: 'Contract',
4260+
managedBy: 'platform',
4261+
fields: {
4262+
id: { label: 'Id', type: 'text' },
4263+
name: { label: 'Name', type: 'text' },
4264+
terms: { label: 'Terms', type: 'text' },
4265+
secret_note: { label: 'Secret note', type: 'text' },
4266+
},
4267+
};
4268+
/** What the server serves the approver: its masker took `secret_note` out (that strip is the server's to pin). */
4269+
const SERVED = { id: REC, name: 'Supply contract', terms: 'Net 30 days' };
4270+
4271+
/** A `/me/permissions` answer naming `objects` and `fields`, as the server resolves it. */
4272+
function answer(
4273+
objects: MePermissionsAuthenticatedResponse['objects'],
4274+
fields: MePermissionsAuthenticatedResponse['fields'] = {},
4275+
): MePermissionsAuthenticatedResponse {
4276+
return {
4277+
authenticated: true,
4278+
userId: 'u1',
4279+
tenantId: null,
4280+
positions: [],
4281+
hasAnyQueue: false,
4282+
objectsUsingQueues: [],
4283+
permissionSets: [],
4284+
objects,
4285+
fields,
4286+
};
4287+
}
4288+
/** The approver: the answer names another object and grants nothing on this one. */
4289+
const APPROVER = answer({ os_39709_other: { allowRead: true } });
4290+
const FULL = { allowRead: true, allowCreate: true, allowEdit: true, allowDelete: true };
4291+
4292+
function makeMetadata() {
4293+
const pages: unknown[] = [];
4294+
return {
4295+
objects: [], pages, loading: false, error: null,
4296+
refresh: async () => {}, invalidate: () => {},
4297+
ensureType: async () => pages, getItem: async () => null,
4298+
getItemsByType: () => pages,
4299+
} as never;
4300+
}
4301+
4302+
function headerEdit(): HTMLButtonElement | null {
4303+
const bar = document.querySelector('[role="toolbar"]');
4304+
if (!bar) return null;
4305+
return (Array.from(bar.querySelectorAll('button'))
4306+
.find((b) => (b.textContent ?? '').trim().toLowerCase() === 'edit') as HTMLButtonElement | undefined) ?? null;
4307+
}
4308+
4309+
async function mountRecord(perms: MePermissionsResponse, served: Record<string, unknown> | null) {
4310+
const ds = {
4311+
find: vi.fn(async () => ({ data: [], total: 0, hasMore: false, pageSize: 50 })),
4312+
findOne: vi.fn(async () => (served ? { ...served } : null)),
4313+
create: vi.fn(async (_o: string, row: Record<string, unknown>) => row),
4314+
update: vi.fn(async () => ({})),
4315+
delete: vi.fn(async () => ({})),
4316+
getObjectSchema: async () => objectDef,
4317+
};
4318+
render(
4319+
<MemoryRouter initialEntries={[`/apps/crm/${OBJECT}/record/${REC}`]}>
4320+
<MetadataCtx.Provider value={makeMetadata()}>
4321+
<NavigationProvider>
4322+
<MePermissionsProvider initialPermissions={perms}>
4323+
<Routes>
4324+
<Route
4325+
path="/apps/:appName/:objectName/record/:recordId"
4326+
element={
4327+
<RecordDetailView dataSource={ds as never} objects={[objectDef] as never} onEdit={() => {}} />
4328+
}
4329+
/>
4330+
</Routes>
4331+
</MePermissionsProvider>
4332+
</NavigationProvider>
4333+
</MetadataCtx.Provider>
4334+
</MemoryRouter>,
4335+
);
4336+
await waitFor(() => expect(ds.findOne).toHaveBeenCalled());
4337+
return ds;
4338+
}
4339+
4340+
/** Let the page settle after the read, so an absence is read on a page that finished drawing. */
4341+
async function settle() {
4342+
await act(async () => {
4343+
for (let i = 0; i < 10; i++) await new Promise((r) => setTimeout(r, 0));
4344+
});
4345+
}
4346+
4347+
beforeAll(() => {
4348+
Object.defineProperty(window, 'innerWidth', { configurable: true, value: 1280 });
4349+
});
4350+
4351+
beforeEach(() => {
4352+
// Unrelated chrome (approvals, row-level verdicts) reaches for the platform
4353+
// API; happy-dom would resolve those relative URLs to a real socket, which
4354+
// the repo's network-escape guard fails the file for (objectui#6640).
4355+
vi.stubGlobal('fetch', vi.fn(async () => ({
4356+
ok: true,
4357+
status: 200,
4358+
json: async () => ({ allowed: true, data: [] }),
4359+
text: async () => '{}',
4360+
})) as never);
4361+
});
4362+
4363+
afterEach(() => {
4364+
cleanup();
4365+
vi.unstubAllGlobals();
4366+
});
4367+
4368+
it('draws the served title and fields for a reader the answer grants no read on the object', async () => {
4369+
await mountRecord(APPROVER, SERVED);
4370+
await waitFor(() => expect(document.querySelector('h1')?.textContent).toContain('Supply contract'));
4371+
await waitFor(() => expect(document.body.textContent).toContain('Net 30 days'));
4372+
});
4373+
4374+
it('keeps writes gated for that reader: no Edit in the header', async () => {
4375+
await mountRecord(APPROVER, SERVED);
4376+
await waitFor(() => expect(document.body.textContent).toContain('Net 30 days'));
4377+
await settle();
4378+
expect(headerEdit()).toBeNull();
4379+
});
4380+
4381+
it('CONTROL: a reader whose answer names the object keeps the field mirror, even for a served field', async () => {
4382+
// A backend that does not strip: the denied field rides the row, and the
4383+
// client mirror is what keeps it off the page for this reader.
4384+
await mountRecord(
4385+
answer({ [OBJECT]: FULL }, { [`${OBJECT}.secret_note`]: { readable: false, editable: false } }),
4386+
{ ...SERVED, secret_note: 'Merger planned' },
4387+
);
4388+
await waitFor(() => expect(document.body.textContent).toContain('Net 30 days'));
4389+
await waitFor(() => expect(headerEdit()).not.toBeNull());
4390+
await settle();
4391+
expect(document.body.textContent).not.toContain('Merger planned');
4392+
});
4393+
4394+
it('CONTROL: a record the server did not serve keeps the not-found state', async () => {
4395+
await mountRecord(APPROVER, null);
4396+
await waitFor(() => expect(screen.getByTestId('record-not-found')).toBeTruthy());
4397+
expect(document.body.textContent).not.toContain('Supply contract');
4398+
});
4399+
});

‎ui/packages/app-shell/src/views/RecordDetailView.tsx‎

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { unresolvedThreadCount } from '@object-ui/plugin-detail';
1616
import { Empty, EmptyTitle, EmptyDescription, Button, PageHeaderActions, PageHeaderPhoneContext, PageHeaderTrailingContext, PanelToggles, ObjectIconTile, RecordHeaderBarContext, RecordHeaderStateContext, RecordTopBar, RecordTopBarButton, cn, useRecordStepKeys, type PanelToggleItem, type RecordHeaderBar, type RecordHeaderGroupParts, type RecordHeaderState, type RecordTopBarStepper } from '@object-ui/components';
1717
import { isActingApprover } from '../utils/approvalDecisionFold.js';
1818
import { useAuth, createAuthenticatedFetch } from '@object-ui/auth';
19-
import { usePermissions } from '@object-ui/permissions';
19+
import { ServerReadScope, usePermissions } from '@object-ui/permissions';
2020
import { useDisplayLocale, useLocalization, pickLocalized } from '@object-ui/i18n';
2121
import { ActionProvider, useObjectTranslation, useObjectLabel, useActionTextLocalizer, usePageAssignment, isRecordPageOf, useMetadata, RecordContextProvider, SchemaRenderer, DiscussionContextProvider, HighlightFieldsProvider, InlineEditProvider, resolveApprovalLock, useGlobalUndo, useDataInvalidation, notifyDataChanged, subscribeDataChanges, dataChangeMatches, useRowPredicate, usePredicateScope, classifyLoadError, answeredLoadFailure, extractWriteErrorMessage, isExternalWriteRefusal } from '@object-ui/react';
2222
import type { AnsweredLoadFailure } from '@object-ui/react';
@@ -455,6 +455,9 @@ export function resolveRecordHeaderActionGates(
455455
};
456456
}
457457

458+
/** `ServerReadScope`'s object list on a record page the server reads no record for (objectstack#39709): one identity, so the scope's value is cached once. */
459+
const NO_SERVER_READ_OBJECTS: readonly string[] = Object.freeze([]);
460+
458461
/** Gated copies of served rows, keyed on the served row object itself. */
459462
const READABLE_ROWS = new WeakMap<object, { kept: string; row: unknown }>();
460463

@@ -1347,7 +1350,27 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri
13471350
// comes back. When something is, the gated copy is cached outside React on
13481351
// the served row (`readableRow`), NOT on a `useMemo` (AGENTS.md #10), so a
13491352
// re-render never republishes an equal row as a new object to the page.
1350-
const readablePageRecord = readableRow(pageRecord, perms, objectName);
1353+
//
1354+
// objectstack#39709 — except where the server read the record through a door
1355+
// the permissions answer does not describe: a pending approver with no object
1356+
// read reads the one record the request is about while their step waits (the
1357+
// rulings on objectstack#26180 and objectstack#39485). The data API served
1358+
// the row, stripped by the reader's own field rules; the answer, which
1359+
// describes the data API's standing rule, grants no read on the object, so
1360+
// both read mirrors fail closed and the page drew nothing it was served.
1361+
// There the page draws the row as served, and its body reads under
1362+
// `ServerReadScope` for this object (`pageTree` below). Keyed on the server's
1363+
// answer alone (the row is held for this route, and the loaded answer grants
1364+
// no read), never on the client's reading of who approves what. A reader
1365+
// whose answer grants the read keeps the mirror above unchanged.
1366+
const serverReadsRecord =
1367+
!!objectName
1368+
&& perms.isLoaded
1369+
&& pageRecordFor === routeRecordKey
1370+
&& !!pageRecord
1371+
&& typeof pageRecord === 'object'
1372+
&& !perms.check(objectName, 'read').allowed;
1373+
const readablePageRecord = serverReadsRecord ? pageRecord : readableRow(pageRecord, perms, objectName);
13511374

13521375
// objectstack#35415 — on an approval request's page, what the page's own
13531376
// reads of a record learned (`recordReadReport.ts`): the title links to the
@@ -5046,7 +5069,16 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri
50465069
attachments: !!(filesEnabled && !hasAttachments && pureRecordId),
50475070
});
50485071
const pageTree = (
5049-
// objectstack#35892 — a related tab draws the list page's condition row.
5072+
// objectstack#39709 — the record's own object, while the server reads this
5073+
// record for a reader the answer grants no read on (`serverReadsRecord`):
5074+
// the page's blocks draw the row and its fields as served. Only the two
5075+
// READ verdicts move, for this object only; writes, export, actions,
5076+
// related lists of other objects and every other page keep the enclosing
5077+
// answer. Mounted on every record page with no object named otherwise, so
5078+
// the tree keeps its shape and the page's blocks are not remounted when
5079+
// the read lands or is read again.
5080+
<ServerReadScope objects={serverReadsRecord && objectName ? [objectName] : NO_SERVER_READ_OBJECTS}>
5081+
{/* objectstack#35892 — a related tab draws the list page's condition row. */}
50505082
<RelatedListConditionsSlotContext.Provider value={renderRelatedListConditions}>
50515083
<RecordHeaderBarContext.Provider value={headerBarForRecord}>
50525084
<RecordHeaderStateContext.Provider value={recordHeaderState}>
@@ -5613,6 +5645,7 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri
56135645
</RecordHeaderStateContext.Provider>
56145646
</RecordHeaderBarContext.Provider>
56155647
</RelatedListConditionsSlotContext.Provider>
5648+
</ServerReadScope>
56165649
);
56175650
// A drawer draws this view embedded and is its own host. A page is the host
56185651
// of the drawer its related rows and lookups open over it

0 commit comments

Comments
 (0)