From 5e45ca509bfa35c15724fc61004dfb0932a1869d Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Fri, 17 Jan 2025 18:23:38 -0800 Subject: [PATCH] remove iterable from jinja --- .../jinja/web/pages/utils.js.jinja2 | 26 ------------------- reflex/components/component.py | 22 +--------------- 2 files changed, 1 insertion(+), 47 deletions(-) diff --git a/reflex/.templates/jinja/web/pages/utils.js.jinja2 b/reflex/.templates/jinja/web/pages/utils.js.jinja2 index e046c9160..176a5d063 100644 --- a/reflex/.templates/jinja/web/pages/utils.js.jinja2 +++ b/reflex/.templates/jinja/web/pages/utils.js.jinja2 @@ -6,8 +6,6 @@ {% filter indent(width=indent_width) %} {%- if component is not mapping %} {{- component }} - {%- elif "iterable" in component %} - {{- render_iterable_tag(component) }} {%- elif component.children|length %} {{- render_tag(component) }} {%- else %} @@ -40,30 +38,6 @@ {%- endmacro %} -{# Rendering condition component. #} -{# Args: #} -{# component: component dictionary #} -{% macro render_condition_tag(component) %} -{ {{- component.cond_state }} ? ( - {{ render(component.true_value) }} -) : ( - {{ render(component.false_value) }} -)} -{%- endmacro %} - - -{# Rendering iterable component. #} -{# Args: #} -{# component: component dictionary #} -{% macro render_iterable_tag(component) %} -<>{ {%- if component.iterable_type == 'dict' -%}Object.entries({{- component.iterable_state }}){%- else -%}{{- component.iterable_state }}{%- endif -%}.map(({{ component.arg_name }}, {{ component.arg_index }}) => ( - {% for child in component.children %} - {{ render(child) }} - {% endfor %} -))} -{%- endmacro %} - - {# Rendering props of a component. #} {# Args: #} {# component: component dictionary #} diff --git a/reflex/components/component.py b/reflex/components/component.py index fe6b9faa3..351be7cbb 100644 --- a/reflex/components/component.py +++ b/reflex/components/component.py @@ -66,7 +66,7 @@ from reflex.vars.base import ( Var, cached_property_no_lock, ) -from reflex.vars.function import ArgsFunctionOperation, FunctionStringVar +from reflex.vars.function import FunctionStringVar from reflex.vars.object import ObjectVar from reflex.vars.sequence import LiteralArrayVar @@ -2399,26 +2399,6 @@ def render_dict_to_var(tag: dict | Component | str, imported_names: set[str]) -> return render_dict_to_var(tag.render(), imported_names) return Var.create(tag) - if "iterable" in tag: - function_return = Var.create( - [ - render_dict_to_var(child.render(), imported_names) - for child in tag["children"] - ] - ) - - func = ArgsFunctionOperation.create( - (tag["arg_var_name"], tag["index_var_name"]), - function_return, - ) - - return FunctionStringVar.create("Array.prototype.map.call").call( - tag["iterable"] - if not isinstance(tag["iterable"], ObjectVar) - else tag["iterable"].items(), - func, - ) - props = {} special_props = []