Skip to content

Page-block canvas draws the generic unknown-block icon for types that render fine but are excluded from the palette (record:chatter) #5837

Description

@os-zhuang

Observation filed unassigned by the domain:ui dev seat implementing #5495 (palette offers the canonical record:discussion). Not a regression that change introduced — the same gap existed before it, on the other spelling — but #5495 moves which spelling is affected, so it is worth recording rather than leaving for the next reader to re-derive.

What was measured

packages/app-shell/src/views/metadata-admin/previews/PageBlockCanvas.tsx draws every node's icon and colour tone from the palette catalogue:

const meta = BLOCK_TYPE_META[typeStr as BlockTypeId];
const Icon = meta?.Icon ?? UnknownBlockIcon;
const tone = resolveBlockTone(typeStr); // -> BLOCK_CATEGORY_TONE['misc'] on a miss

BLOCK_TYPE_META is the palette's offer list, and PALETTE_EXCLUSIONS (same file, block-types.ts) is its documented ledger of block types that are deliberately not offered. Those two lists answer "what may an author drag in", which is a different question from "what may an author already have in this page" — but the canvas chrome reads only the first.

For every exclusion whose reason is "no renderer" (ai:chat_window, element:form, element:record_picker, element:text_input) the generic box is arguably right: those nodes genuinely do not render. One exclusion is different: the record:chatter / record:discussion pair is excluded because the pair is one renderer under two names, so exactly one of the two spellings is always an unoffered type that renders perfectly. Opening an existing page that carries the unoffered spelling shows that node in the outline with UnknownBlockIcon (a plain box) and the neutral misc grey tone, instead of MessageSquare and the blue record tone its twin gets one line above.

blockLabel() is not affected — it never reads BLOCK_TYPE_META, and falls back to the raw type string. The gap is icon + tone only.

Why this is not new, and what #5495 changed about it

Before #5495 the unoffered spelling was the canonicalrecord:discussion — the one packages/plugin-detail/src/synth/buildDefaultPageSchema.ts emits, i.e. the one in every page the platform generates for itself. After #5495 it is the legacy record:chatter alias, which is the rarer spelling. So the change strictly reduces how often this is seen; it does not close it.

Shape of a fix, if it is wanted

The information needed already exists — the pair shares a renderer, a category and an icon. Options, roughly in order of size:

  • a small alias→canonical display map consulted by PageBlockCanvas when BLOCK_TYPE_META misses, so an unoffered-but-renderable type borrows its twin's icon and tone without becoming offerable (block-config.test.ts's "no type is both offered and excluded" must keep holding — which is why this cannot simply be a second BLOCK_TYPE_META entry);
  • or split the catalogue into "display meta" (every type the canvas can encounter) and "palette offer list" (the subset an author may drag), making the two questions above two lists instead of one.

Either is larger than the S-size #5495 card and touches its hot file, so it was deliberately not folded in.

Refs: #5495 (where it surfaced, and the PR that moves which spelling is affected) · #2943 (the guard that made PALETTE_EXCLUSIONS an explicit ledger).

Metadata

Metadata

Assignees

Labels

domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:dispatched

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions