Skip to content

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

Open

Description

@harold18m

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions