Skip to content

Commit 5faf122

Browse files
committed
docs(spec/ui): the object-tree titleField rationale is true at the pin again
At objectui 20c6d351a nothing reads a tree `titleField`: the renderer's `getTreeConfig` rung went on objectui#8841, and the `case 'tree'` arm's flatten rung went on objectui#6152 round 14 (objectui `3fd862510`), so `ListView.tsx:3985` now reads `treeCfg.labelField || 'name'` and emits no `titleField`. The OBJECT_TREE_FLAT_CONFIG_GUIDANCE docblock and the last sentence of its prescription said the key was "only ever read as that key's last fallback", a read that no longer exists. The prose now says why the key stays in the set (for its prescription, not for a read), and the prescription still names `tree.labelField`. The flat key set and every schema shape are unchanged; keeping or dropping `titleField` from the set is a schema decision outside this change. The in-test note beside the key-set pin gains the same dated reading. Claude-Session: https://claude.ai/code/session_01DhTqaEHqPVSVnAkjG3jywn Co-authored-by: Claude <noreply@anthropic.com>
1 parent 675b121 commit 5faf122

2 files changed

Lines changed: 25 additions & 15 deletions

File tree

‎packages/spec/src/ui/component.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4314,7 +4314,11 @@ describe('object-map / object-gantt / object-tree — key sets derived from the
43144314
// still resolves `treeCfg.titleField` into `labelField` before emitting
43154315
// (`ListView.tsx:3270` at this pin), so an authored `titleField` is still
43164316
// only ever the block's `labelField`. What died is the renderer's own
4317-
// fallback, not the flatten's.
4317+
// fallback, not the flatten's. At `20c6d351a` the flatten's rung is gone
4318+
// too (objectui#6152 round 14, objectui `3fd862510`: `ListView.tsx:3985`
4319+
// reads `treeCfg.labelField || 'name'`), so no half reads `titleField`;
4320+
// it stays in the set for the prescription it carries, which names
4321+
// `tree.labelField` (see `OBJECT_TREE_FLAT_CONFIG_GUIDANCE`).
43184322
expect(setFor('object-tree', 'OBJECT_TREE_FLAT_CONFIG_KEYS'))
43194323
.toEqual([...Object.keys(TreeConfigSchema.shape), 'titleField'].sort());
43204324
});

‎packages/spec/src/ui/component.zod.ts‎

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8611,19 +8611,25 @@ export type ObjectGanttPropsParsed = z.infer<typeof ObjectGanttPropsSchema>;
86118611
* uses above. The registration agrees: `plugin-tree/src/index.tsx` declares
86128612
* `{ name: 'tree', type: 'object' }` and no flat input.
86138613
*
8614-
* `titleField` is in the set although no `tree` block key is spelled that way:
8615-
* `ListView`'s flatten resolves `treeCfg.titleField` into `labelField` before
8616-
* emitting (`ListView.tsx:3927`, `labelField: treeCfg.labelField ||
8617-
* treeCfg.titleField || 'name'`), so the author's intent is always the block's
8618-
* `labelField`, and the prescription below says so.
8619-
*
8620-
* ⚠️ The renderer's own half of that sentence is GONE, and it is a DELETED
8621-
* read rather than a moved one: `getTreeConfig`'s `?? schema.titleField` rung
8622-
* — the `:117` this record used to cite — was removed on objectui#8841
8623-
* because it read the FLATTENED NODE and never the block, and the docblock at
8614+
* `titleField` is in the set although no `tree` block key is spelled that way,
8615+
* and at `20c6d351a` NOTHING reads it: both halves that once did are DELETED
8616+
* reads, not moved ones. The flatten half went on objectui#6152 round 14
8617+
* (objectui `3fd862510`): at `47b1f0bb7` the `case 'tree'` arm resolved
8618+
* `labelField: treeCfg.labelField || treeCfg.titleField || 'name'` (`:3927`);
8619+
* at `20c6d351a` it reads `labelField: treeCfg.labelField || 'name'`
8620+
* (`ListView.tsx:3985`) and emits no `titleField`. The renderer half went
8621+
* earlier: `getTreeConfig`'s `?? schema.titleField` rung — the `:117` this
8622+
* record used to cite — was removed on objectui#8841 because it read the
8623+
* FLATTENED NODE and never the block, and the docblock at
86248624
* `ObjectTree.tsx:240-261` records the three measurements that retired it.
8625-
* The flatten half above is what keeps the key in this set; ⛔ do not restore
8626-
* the renderer half from this record's history.
8625+
* This paragraph is the correction the 2026-10-10 re-read above reported;
8626+
* ⛔ restore neither rung from this record's history.
8627+
*
8628+
* So `titleField` is in this set for its prescription, not for a read: an
8629+
* author who writes a flat `titleField` on an `object-tree` is naming the
8630+
* tree's label field, and the one key that does that is `tree.labelField`,
8631+
* which the prescription below says. Keeping or dropping `titleField` from
8632+
* the set is a schema decision this record does not make.
86278633
*/
86288634
const OBJECT_TREE_FLAT_CONFIG_GUIDANCE: readonly KeySetGuidance[] = [
86298635
...COMPONENT_LEVEL_GUIDANCE,
@@ -8634,8 +8640,8 @@ const OBJECT_TREE_FLAT_CONFIG_GUIDANCE: readonly KeySetGuidance[] = [
86348640
prescription:
86358641
'Write this as a key of the `tree` config object instead — `tree: { parentField, labelField, fields, '
86368642
+ 'defaultExpandedDepth }`. The flat top-level spelling is the internal form `ObjectView`/`ListView` '
8637-
+ 'produce when they flatten `options.tree`, not a second authoring spelling. A `titleField` is the '
8638-
+ "block's `labelField`: it is only ever read as that key's last fallback.",
8643+
+ 'produce when they flatten `options.tree`, not a second authoring spelling. A `titleField` names the '
8644+
+ "tree's label field, which the `tree` block spells `labelField`: write `tree: { labelField }`.",
86398645
},
86408646
];
86418647

0 commit comments

Comments
 (0)