Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
15f363b
Add compiler plugin hooks and move compilation pipeline out of App
FarhanAliRaza Apr 3, 2026
b425f01
Fix memo component ordering and Var-backed page title handling
FarhanAliRaza Apr 3, 2026
2ab0557
Fix app wrap component collection for stateful components
FarhanAliRaza Apr 3, 2026
baee2bd
Merge remote-tracking branch 'upstream/main' into compiler-hooks
FarhanAliRaza Apr 3, 2026
18319ea
pyi hashes
FarhanAliRaza Apr 3, 2026
db4059c
pyi hashes
FarhanAliRaza Apr 3, 2026
94f0d5f
added comparison benchmark
FarhanAliRaza Apr 3, 2026
e64a091
Replace global StatefulComponent cache with compile-scoped cache
FarhanAliRaza Apr 3, 2026
1948394
fixed benchmarks and cache render and deduplicate functions
FarhanAliRaza Apr 4, 2026
4b04b09
fixed benchmarks and cache render and deduplicate functionsand merge
FarhanAliRaza Apr 4, 2026
1cf4962
fix import
FarhanAliRaza Apr 4, 2026
ddaf242
fix broken _get_vars cache and add imports/hooks caches
FarhanAliRaza Apr 5, 2026
41204c1
Simplify compiler hooks: merge tree walkers and remove optimization f…
FarhanAliRaza Apr 6, 2026
733f4e5
Fix stateful component imports not included in all_imports
FarhanAliRaza Apr 6, 2026
292d095
Remove CompilerPlugin and PageDefinition protocols, use concrete types
FarhanAliRaza Apr 6, 2026
a0255f9
pyi hashes
FarhanAliRaza Apr 6, 2026
4eaa2da
removed orphaned code used by legacy compiler
FarhanAliRaza Apr 6, 2026
92c30de
Merge remote-tracking branch 'upstream/main' into compiler-hooks
FarhanAliRaza Apr 7, 2026
d7f43b8
fixed borken merge
FarhanAliRaza Apr 7, 2026
c50b245
fix reflex dep as git url exclusion for reflex-web CI
masenf Apr 7, 2026
0f91a26
reflex web fix
FarhanAliRaza Apr 7, 2026
9f226a4
Merge branch 'compiler-hooks' of https://github.com/FarhanAliRaza/ref…
FarhanAliRaza Apr 7, 2026
d391cd0
integration-tests.yml: do not reinstall reflex from git
masenf Apr 7, 2026
ee4dcb4
Replace StatefulComponent with MemoizeStatefulPlugin compiler plugin
FarhanAliRaza Apr 7, 2026
50e8877
Add _validate_component_children bypass for experimental memo wrappers
FarhanAliRaza Apr 7, 2026
5f09c98
fix test
FarhanAliRaza Apr 8, 2026
d87e637
Merge branch 'main' into compiler-hooks
FarhanAliRaza Apr 8, 2026
3dc14f1
fixed buffer upload
FarhanAliRaza Apr 8, 2026
af85fa2
fixed buffer upload by shortcircuiting
FarhanAliRaza Apr 8, 2026
620c84d
Skip buffered upload handler when probe chunk detects client disconnect
FarhanAliRaza Apr 8, 2026
f1e7b67
Merge branch 'main' into compiler-hooks
FarhanAliRaza Apr 8, 2026
e7dfb81
pyi hashes
FarhanAliRaza Apr 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions packages/reflex-base/src/reflex_base/compiler/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

if TYPE_CHECKING:
from reflex.compiler.utils import _ImportDict
from reflex_base.components.component import Component, StatefulComponent
from reflex_base.components.component import Component


def _sort_hooks(
Expand Down Expand Up @@ -417,7 +417,7 @@ def context_template(
}}"""


def component_template(component: Component | StatefulComponent):
def component_template(component: Component):
"""Template to render a component tag.

Args:
Expand Down Expand Up @@ -618,40 +618,41 @@ def vite_config_template(
}}));"""


def stateful_component_template(
tag_name: str, memo_trigger_hooks: list[str], component: Component, export: bool
):
"""Template for stateful component.
def dynamic_component_template(
tag_name: str, component: Component, export: bool
) -> str:
"""Template for a dynamic SSR component function declaration.

Args:
tag_name: The tag name for the component.
memo_trigger_hooks: The memo trigger hooks for the component.
component: The component to render.
export: Whether to export the component.

Returns:
Rendered stateful component code as string.
Rendered dynamic component code as string.
"""
all_hooks = component._get_all_hooks()
return f"""
{"export " if export else ""}function {tag_name} () {{
{_render_hooks(all_hooks, memo_trigger_hooks)}
{_render_hooks(all_hooks)}
return (
{_RenderUtils.render(component.render())}
)
}}
"""


def stateful_components_template(imports: list[_ImportDict], memoized_code: str) -> str:
"""Template for stateful components.
def dynamic_components_module_template(
imports: list[_ImportDict], memoized_code: str
) -> str:
"""Template for a dynamic-SSR components module.

Args:
imports: List of import statements.
memoized_code: Memoized code for stateful components.
memoized_code: Code for the module body.

Returns:
Rendered stateful components code as string.
Rendered module code as string.
"""
imports_str = "\n".join([_RenderUtils.get_import(imp) for imp in imports])
return f"{imports_str}\n{memoized_code}"
Expand Down
Loading
Loading