Remove interim `Tag` in Component render pipeline

Open
#7,618 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, python, react

Research direction

Start with packages/reflex-base/src/reflex_base/components/component.py and trace how compiler templates consume the render dict. The issue also names packages/reflex-base/src/reflex_base/components/tags/ and related work #6235 and #6214 as context. Done means rendering produces a Var for the jsx(...) call, compiler templates consume it, and the deprecation path for _render() overrides is addressed.

Written by the indexing model from the issue text.

Description

roadmap

Summary

Component._render() returns a Tag, and Component.render() turns it into a render dict that the compiler templates serialize into JSX. Replace that interim stage: Component.render() returns a Var representing the jsx(...) function call, and the Var carries the hooks, imports and app wraps the component requires through its VarData. This is a breaking change for code that subclasses the render path.

Why

  • A rendered component becomes an ordinary value in the Var system, so a component can appear wherever a Var is accepted (props, cond/match/foreach branches, memo returns) without the special-cased Component-to-Var conversion, which today drops part of the VarData (Linear ENG-9593).
  • The Tag/render-dict stage is an untyped dict between Python objects and emitted JS. Collapsing it removes a layer the single-pass compiler (#6235) has to walk and lets a _get_var_data()-style collection replace the separate hooks, app wraps, imports and custom-code paths on Component.
  • Immutable components (#6214) already treat a component as a value; rendering to a Var is the matching output side.

Scope

  • Component._render() / Component.render() produce a Var for the jsx call instead of a CommonTag / render dict (packages/reflex-base/src/reflex_base/components/component.py).
  • packages/reflex-base/src/reflex_base/components/tags/ is removed, or kept as an internal helper for the deprecation window only.
  • Compiler templates consume the rendered Var instead of the render dict.
  • Deprecation path for components that override _render() to return a Tag.

Related

  • #6235 Single Pass Compiler: Tracking Issue
  • #6214 Single-pass compiler: Make Component effectively immutable
Dominant language
Python
Stars
29k
Forks
1.8k
Avg merge
2d 22h
Merged PRs (30d)
143

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from reflex-dev/reflex

All issues in reflex-dev/reflex

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.