#460

react-email: unknown component types and children of leaf components are dropped silently

Openharold18mopened 5d ago

Two cases in @json-render/react-email drop content with no error or warning:

  1. Unknown component type → if (!Component) return null (render.tsx#L59).
  2. Children on leaf components (Text, Heading, Link, Button, Image, Hr, Preview) are ignored, since those components only render props.text. A common LLM output like Link > Image just disappears from the HTML.

validateSpec doesn't catch either (it checks missing_child and orphaned_element, but not unknown types or children on leaves).

With LLM-generated specs this is the hardest kind of bug to notice: the email renders fine, just missing pieces. We ended up writing our own validator to catch it.

Proposal: a console.warn in dev for unknown types, and/or a catalog-aware check (e.g. validateSpec(spec, { catalog })) that flags children on components that don't accept them.

Activity

0

No activity yet.