Remove interim `Tag` in Component render pipeline

Đang mở
#7,618 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, python, react
Lĩnh vực
backend, devtools, frontend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Python
Star
29k
Fork
1.8k
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
143

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của reflex-dev/reflex

Tất cả issue của reflex-dev/reflex

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.