Skip to content

Commit ed4a91f

Browse files
docs(data): describe the built-in value lock that actually exists (#360)
#303 removed `isBuiltInValueLocked` and `lockedBuiltInCellKey`, but the docs still describe them. Both symbols now have zero references anywhere in the codebase. The paragraph is not just naming dead functions, it states the opposite of current behavior. It says built-in row values are read-only on the structural system tables. They are editable on existing records, exactly as the guard's own header says. What survives is a narrower create-time rule: `protectedBuiltInCreateCellKey` rejects a create that supplies built-in cells for a structural system table, so those rows are born through their own authoring surfaces rather than the generic row endpoint. `posts` is exempt, and the server enforces it in `server/handlers/cms/data/tables.ts`. PageTreeCell and its test carried the same dead reference in comments, justifying the always-read-only button behavior by a predicate that no longer exists. The behavior is right and unchanged; the reasoning is now stated in terms of what a `pageTree` cell is (authored in the visual editor, never typed into a cell) rather than a deleted lock. Docs only, plus two comments. No behavior change.
1 parent 9d787b2 commit ed4a91f

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

docs/features/data-workspace.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ isLabelLocked(field, table) // true for built-in postType fields and sys
118118
deleteTooltip(field, table) // disabled-button tooltip text, or undefined
119119
```
120120

121-
Built-in field **values** (row cells) are additionally read-only on the *structural* system tables (pages/components/layouts) via `isBuiltInValueLocked` (`@core/data/systemTableGuard`); `posts` built-in values stay editable. The same predicate backs the server's row-write rejection (`lockedBuiltInCellKey`).
121+
Built-in field **values** (row cells) stay editable on existing records everywhere, including the *structural* system tables (pages/components/layouts). The one remaining value lock is at **create** time: `protectedBuiltInCreateCellKey` (`@core/data/systemTableGuard`) rejects a create that supplies built-in cells for a structural system table, so those rows are born through their own authoring surfaces rather than the generic row endpoint. `posts` is exempt (`kind === 'postType'`), and the server enforces this in `server/handlers/cms/data/tables.ts`.
122122

123123
`FIELD_TYPE_LABELS` maps every `DataFieldType` to a human-readable string and
124124
is shared by `FieldRow` and `FieldSchemaComposer`.

src/admin/pages/data/components/DataGrid/cells/PageTreeCell.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ function button(): HTMLButtonElement {
3535
}
3636

3737
describe('PageTreeCell', () => {
38-
// A `pageTree` cell on a system table is ALWAYS readOnly — every built-in
39-
// field of `pages` / `components` / `layouts` is value-locked. The button
40-
// navigates to the visual editor rather than editing the cell, so gating it
41-
// on readOnly disabled it on exactly the rows it exists for.
38+
// A `pageTree` cell is never editable inline — the tree is authored in the
39+
// visual editor, not typed into a cell. The button navigates to that editor
40+
// rather than editing the cell, so gating it on readOnly disabled it on
41+
// exactly the rows it exists for.
4242
it('stays enabled on a read-only cell when a handler is wired', async () => {
4343
let opened = 0
4444
renderCell({ readOnly: true, onOpenEditor: () => { opened += 1 } })

src/admin/pages/data/components/DataGrid/cells/PageTreeCell.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
* pattern that `RelationCell` uses for `onOpenPicker`.
1111
*
1212
* `readOnly` deliberately does NOT gate the button. It means "this value is
13-
* not editable in the grid", which is always true for a `pageTree` cell on a
14-
* system table (`isBuiltInValueLocked` holds for every built-in field of
15-
* `pages` / `components` / `layouts`). The button edits nothing — it navigates
16-
* to the visual editor, which enforces its own permissions. Gating it on
17-
* `readOnly` disabled it on exactly the rows it exists for.
13+
* not editable inline in the grid", which a `pageTree` cell never is — the
14+
* tree is authored in the visual editor, not typed into a cell. The button
15+
* edits nothing, it navigates to that editor, which enforces its own
16+
* permissions. Gating it on `readOnly` disabled it on exactly the rows it
17+
* exists for.
1818
*/
1919
import type { ReactElement } from 'react'
2020
import { Button } from '@ui/components/Button'

0 commit comments

Comments
 (0)