Repository navigation
Description
Package: @metaobjectsdev/tanstack 0.24.5 (renderer registry) vs. @metaobjectsdev/metadata 0.24.5 (view subtype registry)
What's wrong
@metaobjectsdev/tanstack's cell-renderers.tsx registers defaultCellRenderers, keyed by a column's meta.view (populated at codegen time from a field's declared view.* subtype):
export const defaultCellRenderers: Record<string, CellRenderer> = {
text: ...,
textarea: ...,
number: ...,
date: (ctx) => { ... return v ? new Date(v as string).toLocaleDateString() : ""; },
datetime: (ctx) => { ... return v ? new Date(v as string).toLocaleString() : ""; },
boolean: ...,
currency: ...,
dropdown: ...,
password: ...,
};But @metaobjectsdev/metadata's registered view.* subtypes (presentation/view/view-constants.ts) are exactly:
base, text, textarea, date, month, hotlink, dropdown, radio, checkbox, number, password, hidden, web, currency, image
There is no view.datetime subtype anywhere in the registry. Since a column's meta.view is always one of the registered view subtypes (there is no other way to populate it via codegen), the datetime key in defaultCellRenderers can never be selected through normal metadata-driven codegen — it's reachable only if application code hand-sets a column's meta.view to "datetime" outside the generated pipeline.
Consequence
A field.timestamp-typed field that should render both a date and a time of day has no matching view subtype to declare. Its only registered option is view.date, whose default renderer is toLocaleDateString() — which drops the time component entirely. An application that wants correct timestamp rendering must either:
- accept the default and silently lose the time-of-day, or
- override the
daterenderer key itself to render date+time, quietly absorbing the responsibility that the presence of a distinct, unreachabledatetimekey implies should be a separate, dedicated concern.
Either way, the registered vocabulary (view.date only) and the renderer registry (date and datetime) disagree about how many concerns exist here, and only one of the two ever actually reflects real dispatch.
Suggested fix
Either:
- Register a
view.datetimesubtype in@metaobjectsdev/metadata(mirroring howdateandmonthare already distinguished) sofieldViewKind()can select it for timestamp-typed fields anddefaultCellRenderers.datetimebecomes reachable, or - Remove the unreachable
datetimekey fromdefaultCellRenderersand document thatview.date's renderer is expected to carry time-of-day rendering whenever it backs a timestamp-typed field, so there's one registered vocabulary term instead of two that disagree.
Activity
dmealing commentedon Aug 31, 2026
Fixed on
main; ships in the next release — and the report understates it by one. Cross-checking the renderer keys against the registered subtypes mechanically:booleanis dead too — and that half is the one that cost something, because of the inverse gap the issue doesn't mention:view.checkboxIS registered and had no renderer at all. So a checkbox column fell throughif (!renderer) return col;and rendered a rawtrue/false, while the "Yes"/"No" renderer plainly written for it sat under the unreachablebooleankey. The renderer existed, the column existed, and the two could never meet.Renaming that key to the registered subtype is the whole fix for that half.
On the two options offered: option 2, with the reasoning slightly different from how it's framed.
datetimeis deleted rather than registered, because the distinction the key implies is already carried by the field subtype —field.timestampandfield.dateare different declared types — so a newview.*subtype would be new vocabulary for a distinction the model already makes, at the cost of movingmetamodelVersionand obliging all four registries to publish.A timestamp that should show time-of-day is served by overriding the
datekey throughCellRendererProvider, which already works. Themetaobjects-runtime-uiskill now says so explicitly — replacing a sentence that listedbooleanamong the selectable keys, i.e. a shipped doc that was teaching one of the dead ones.The missing check is the durable part, and it now exists: a gate asserts every renderer key is a registered view subtype. It lives in
codegen-ts-tanstackrather than the browser package, because@metaobjectsdev/tanstackdeliberately carries no@metaobjectsdev/metadatadependency (#287 made a single value import from that package's root unbundlable) and the codegen package is the one that decides whatmeta.viewcan say.One note for anyone who had overridden the
booleankey: that override was already dead, since no column could ever carrymeta.view: "boolean". Re-key it tocheckbox.fix(tanstack): two cell renderers were keyed to view subtypes that do…
docs(changelog): the four grid/renderer defects, and four landed unit…
fix(grid): a registered view subtype with no renderer printed its raw…
dmealing commentedon Sep 1, 2026
Follow-up on
mainin 25a7772 — this closed the other direction of the same gap.The fix here asserted renderer key → registered subtype, which catches a dead key like
datetime. The converse was never asserted, and that is the halfcheckboxactually lived in:EntityGriddoesif (!renderer) return col, so a registered subtype with no key fallsthrough to TanStack's default cell and prints the raw value, whatever the subtype's own
registered description promises. Five concrete subtypes were in that state.
view.hidden— registered as "Not rendered; carried but not shown", and it renderedits value. The generated form has always honoured it (
<input type="hidden">); the gridcontradicted it outright. The column is now dropped at codegen in both grid tiers rather
than given a blank-cell renderer — a blank cell still holds a header and a sort target, so
the value would be hidden while the column was not. Dropped even when
@columnsnames thefield: that and
view.hiddencontradict each other, and the one about rendering is thespecific answer to the question a grid asks. (Sorting by such a field still works —
defaultSortgoes to the fetcher's query params, not the column model.)view.hotlink— "Renders the value as a clickable link", rendering plain text. Now ananchor, with the scheme checked: the cell value comes from the database, so an anchor built
blindly from a stored string is a
javascript:URL away from executing on click. Anythingnot http/https/mailto renders as text — which is what it did before, so the guard can only
ever be safe.
view.month— rendered the raw stored string. Now a formatted month, parsed field-wise:new Date("2026-09")is UTC midnight and shows the PREVIOUS month to every viewer west ofGreenwich. Asserted under a negative-offset timezone.
view.radio— keyed explicitly todropdown's rendering, so that is recorded ratherthan an accident of the fall-through.
view.image— deliberately left with no default renderer. The field stores an opaquestorage key, so an
<img>needsImageUploadAdapter.imageUrl(), exposed through a Reactcontext in
@metaobjectsdev/react— which@metaobjectsdev/tanstackdoes not depend on.Adding that dependency drags the image-upload/crop graph into every grid consumer's bundle,
the runtime-web/tanstack: browser bundling fails — root barrel transitively imports node:url (fileURLToPath) #287 /
react-easy-cropclass already fixed twice here. The clean version is a@metaobjectsdev/reactsubpath export, and0.21.5already deferred that/imagesplit toa MINOR — so it belongs with that work, not inside a patch. Apps override the
imagekey on<CellRendererProvider>today.The durable part is the converse gate: every concrete view subtype must now have a renderer
OR a written exemption naming why, and a second test fails any exemption that outlives the gap
it explains or names a subtype that does not exist. A missing key was an accident; an exemption
is a decision on the record.
Found while fixing #357 — making all 15
view.*subtypes discoverable to an author is whatmade "and what does the grid do with them?" a question worth asking.
feat(grid): a view.image column can render, without a form-stack depe…