Clickable reference chips in list cells
Reference fields filter through the list-toolbar picker ("Reference-field chip picker"), but the reference value in the row itself is dead text — and "Row click replaces View/Edit icons" made the whole row navigate to the record view, so the "admin" in Model Bank's Owner column is visible but not clickable: the picker is the only path. M2M list fields have no such gap — their row values render as clickable chips (click-to-filter), and the row click disarms on them. The gap is emergent from the seam of the two items, not an oversight of either.
Make the reference cell a chip: a :filter-with :reference field's list-cell value renders as a single click-to-filter chip calling the same toggleChipFilter the picker and the M2M cell chips call (the target-keyed :in union row already flows through fetchList); a nil FK falls through to the plain cell; the chip is a <button>, so INTERACTIVE_SELECTOR disarms the row click for free — no navigation conflict. Frontend-only: buildChipFieldMeta already carries the reference arm, so the change is the cell-renderer branch in App.tsx (the isChipCell m2m qualification gains a reference sibling) plus the clamp/tooltip exclusion; no Lisp changes (the :in path is already pinned by reference-chip-tests).
Implemented per the plan end to end:
- Frontend (
web/src/App.tsx, one site): the list-cell renderer's eligibility is now own-propertychipFieldMetamembership —Object.prototype.hasOwnProperty.call, thesubmitFormspelling (a baref inwould hand a field namedconstructor/toStringinherited metadata through the prototype now that.m2mleft the gate) — withmeta.m2mrouting the family. The M2M arm keeps itsArray.isArrayguard verbatim; a new reference arm renders the one value as a single.chip-cell-wrapped<button>(chip/chip-activeonlistFilters[f]membership, the M2M branch's title pair verbatim,toggleChipFilteron click) whenrec[f]is a non-empty string (hoistedrefValconst — JSX children take only expressions); a NULL FK's[]nil encoding and any non-string fall through torenderCellValue, exactly the plain cell of today. The clamp exemption is recoupled to the actual render branches (chipRendered— M2M-with-array orrefVal !=null=), not membership alone: a nil FK now clamps like ordinary text (it renders ordinary text), and a future chip family without its own branch renders clamped — a safe failure with no layout change.INTERACTIVE_SELECTOR/ row-click guards untouched (thebuttonmember disarms by construction). - Stale comments corrected: the
buildChipFieldMetarender-site comment (eligibility is membership for both families; the per-family render guards own the[]nil story) andfetchList's chip-block comment (one row per selected field, ANDed through the shared join column — the false same-target-union sentence is gone).index.css's section heading now reads "(M2M and reference filter)"; no rule changes.tests/reference-chip-tests.lisp'sreference-chip-cross-target-anddocstring carries the same stale claim but is out of scope (Lisp edit rule) — deferred to a Lisp-permitted item; its assertions pin the AND truth correctly. - Docs:
docs/model-reference.md— the:checkbox-listnote's chip clause now covers both families (an M2M cell's values and a reference cell's single value render as click-to-filter chips; nil renders the plain cell); the filter-operators paragraph anddocs/rest.md'sfiltersrow now say "the reference chip picker and list-cell chips emit" the target-keyed row; the:filter-withrow gains the cell-chip clause, the same-target parenthetical is corrected (two same-target rows compare the one shared join column against both IN lists — distinct selections typically match nothing; per-field rows are not expressible in v1, the joined-column-aliasing relaxation owns the fix), and the new display-vs-identity author invariant is documented (:sourcemust display the target's identity column — cell chips filter on the displayed value — and:source-allmust agree for the picker palette; nothing in the compiler enforces the agreement yet). - Verification:
tsc+vite buildclean (354.87 kB). Full suite viascripts/data-ui tests: 2269 checks, 44 groups, all passed. Dev-REPL probes on thereference-chip-testfixture (development instance, rows inserted and deleted by captured id): cross-target AND (admin+Apollo) → 1; merged single-row("admin" "guest")→ 2 (union within the field); two same-target disjoint rows →0— the AND truth that substantiates the corrected same-target docs wording (a union reading would answer 2). The plan's browser-smoke list (chip click, filter-bar chip, row-click disarm, keyboard Enter, NULL-FK plain cell, non-nameidentity column network check, M2M regression, picker/URL round-trip) is not machine-executable — same posture as every prior frontend item (no JS test harness); the dev fixture is loaded in the development image for it.
Plan: clickable-reference-plan.org
- Slot
- 3500
- Status
- 60 Done
- Tags
- mvp, frontend
- Contributors
- Donnie