Skip to content

Extend reflex docgen#6573

Open
carlosabadia wants to merge 3 commits into
mainfrom
carlos/extend-reflex-docgen
Open

Extend reflex docgen#6573
carlosabadia wants to merge 3 commits into
mainfrom
carlos/extend-reflex-docgen

Conversation

@carlosabadia
Copy link
Copy Markdown
Contributor

No description provided.

@carlosabadia carlosabadia requested review from a team and Alek99 as code owners May 28, 2026 15:07
@carlosabadia carlosabadia added the skip-changelog For doc/internal changes label May 28, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 28, 2026

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing carlos/extend-reflex-docgen (3b9c464) with main (82f90c8)

Open in CodSpeed

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 28, 2026

Greptile Summary

This PR extends the reflex-docgen package with three improvements: exposing the raw YAML frontmatter as a metadata field on FrontMatter and Document, preserving raw directive content in DirectiveBlock.content for line-oriented bodies, and adding a new ReflexComponentTransformer that renders a parsed Document into a tree of rx.Component objects with a drop-in overrides dict replacing the old component_map pattern.

  • FrontMatter gains a metadata: Mapping[str, object] field and _markdown.py's frontmatter renderer now uses it for faithful round-tripping; ReflexComponentTransformer is lazily imported to avoid a hard reflex dependency.
  • docs/app/reflex.lock: removes react-dropzone and its transitive dependencies (attr-accept, file-selector).

Confidence Score: 3/5

The core logic and lazy-import plumbing are sound, but adding an unhashable dict field to a frozen dataclass silently breaks hash() on FrontMatter and Document for any caller that stores them in sets or uses them as dict keys.

The metadata field defaults to a plain dict, which is not hashable. Because FrontMatter is frozen=True, Python generates a hash that tries to hash every field — it will raise TypeError at runtime for any code that relied on the previously-valid hashability of FrontMatter or Document.

packages/reflex-docgen/src/reflex_docgen/markdown/_types.py — the metadata field on FrontMatter needs hash=False to restore safe behaviour for frozen dataclasses.

Important Files Changed

Filename Overview
packages/reflex-docgen/src/reflex_docgen/markdown/_types.py Adds metadata: Mapping[str, object] field to frozen FrontMatter dataclass and content: str to DirectiveBlock; storing a dict in a frozen dataclass breaks the implicit hashability contract.
packages/reflex-docgen/src/reflex_docgen/markdown/transformer/_reflex.py New ReflexComponentTransformer that renders a Document to rx.Component trees with lazy import; _plain_text silently drops LineBreakSpan, potentially merging words in image alt text.
packages/reflex-docgen/src/reflex_docgen/markdown/transformer/_markdown.py Updates frontmatter() to use block.metadata as source of truth for round-tripping, falling back to field-by-field construction for programmatic frontmatter.
packages/reflex-docgen/src/reflex_docgen/markdown/init.py Adds lazy getattr import for ReflexComponentTransformer to keep the module free of a hard reflex dependency until first access.
tests/units/docgen/test_reflex_transformer.py New comprehensive tests for ReflexComponentTransformer; relies on internal Reflex tag attribute for rx.el.a being 'Link', which is an implementation detail.

Reviews (1): Last reviewed commit: "Extend reflex docgen" | Re-trigger Greptile

Comment thread packages/reflex-docgen/src/reflex_docgen/markdown/_types.py Outdated
Comment thread packages/reflex-docgen/src/reflex_docgen/markdown/transformer/__init__.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog For doc/internal changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants