Remove interim `Tag` in Component render pipeline

Aperta
#7,618 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, python, react

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Python
Stelle
29k
Fork
1.8k
Merge medio
2g 22h
PR unite (30g)
143

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di reflex-dev/reflex

Tutte le issue di reflex-dev/reflex

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.