Nested data structures not connected to a State cause hard to decipher errors
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Reproduce the behavior from the linked repository, then trace compiler.py at into_component through foreach.py and iter_tag.py, using the traceback as the entry point. Determine whether nested static BaseModel data should be supported or should produce a clearer error, and add coverage for both the working and failing nested references.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
When you directly pass a python data structure (nested BaseModel) to components you will sometimes get an exception that is hard to understand. It is made more difficult to figure out because accessing some nested elements of the data structure display fine while accessing others causes the exception.
To Reproduce
Steps to reproduce the behavior:
-
In the repo below, just run the app. There are two section that can be commented out/in to demonstrate the exception and how the exception doesn't happen for some references into the data structure.
-
Code/Link to Repo: https://github.com/bertbarabas/test_reflex_no_state_data
Expected behavior
Either a clear exception explaining how data must be associated with State or allow static data structures to be used fully without exceptions. For example you have a catalog that won't change during the session so it doesn't need to be tracked via state.
Specifics (please complete the following information):
- Python Version: 3.14
- Reflex Version: 0.9.3
- OS: Ubuntu 24.04.2 LTS
Traceback
File "/Users/masenf/code/reflex-dev/test_reflex_no_state_data/.venv/lib/python3.14/site-packages/reflex/compiler/compiler.py", line 816, in into_component
component_called = component()
File "/Users/masenf/code/reflex-dev/test_reflex_no_state_data/test_reflex_no_state_data/test_reflex_no_state_data.py", line 199, in index
paint_color_scheme("40R", paint_scheme_catalogs["Approved Paint Schemes"]),
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/masenf/code/reflex-dev/test_reflex_no_state_data/test_reflex_no_state_data/test_reflex_no_state_data.py", line 173, in paint_color_scheme
rx.foreach(
~~~~~~~~~~^
paint_scheme.elements,
^^^^^^^^^^^^^^^^^^^^^^
...<2 lines>...
),
^^
)
^
File "/Users/masenf/code/reflex-dev/test_reflex_no_state_data/.venv/lib/python3.14/site-packages/reflex_components_core/core/foreach.py", line 115, in create
component.children = [component._render().render_component()]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/Users/masenf/code/reflex-dev/test_reflex_no_state_data/.venv/lib/python3.14/site-packages/reflex_base/components/tags/iter_tag.py", line 95, in render_component
component = self.render_fn(arg)
File "/Users/masenf/code/reflex-dev/test_reflex_no_state_data/test_reflex_no_state_data/test_reflex_no_state_data.py", line 175, in <lambda>
lambda paint_scheme_element: paint_color_scheme_element(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
paint_scheme_catalog, paint_scheme_element
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
),
^
File "/Users/masenf/code/reflex-dev/test_reflex_no_state_data/test_reflex_no_state_data/test_reflex_no_state_data.py", line 147, in paint_color_scheme_element
rx.foreach(
~~~~~~~~~~^
paint_scheme_element.paint_color_ids,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<2 lines>...
),
^^
),
^
File "/Users/masenf/code/reflex-dev/test_reflex_no_state_data/.venv/lib/python3.14/site-packages/reflex_components_core/core/foreach.py", line 115, in create
component.children = [component._render().render_component()]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/Users/masenf/code/reflex-dev/test_reflex_no_state_data/.venv/lib/python3.14/site-packages/reflex_base/components/tags/iter_tag.py", line 95, in render_component
component = self.render_fn(arg)
File "/Users/masenf/code/reflex-dev/test_reflex_no_state_data/test_reflex_no_state_data/test_reflex_no_state_data.py", line 150, in <lambda>
paint_color=paint_scheme_catalog.paint_colors[paint_color_id],
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
TypeError: Cannot access a primitive map with a Var. Consider calling rx.Var.create() on the map.
Happened while evaluating page 'index'
- Lenguaje dominante
- Python
- Estrellas
- 29k
- Forks
- 1.8k
- Merge medio
- 3 d 5 h
- PR fusionados (30 d)
- 182
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de reflex-dev/reflex
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
reflex-dev/reflex#8026 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Kept env.py failure: the "move it aside" hint is dropped and a full traceback is logged when alembic.ini uses a relative script_locationPosiblemente ocupada @MaiAditya la tomó hace 13 días. Abiertobug release-train
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
reflex-dev/reflex#7856 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
0.9.12 changelog follow-ups: the #7132 "_get_was_touched" entry describes unreachable behaviour, #7115's hasattr/getattr change is undocumented, #7131's wordingQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertorelease-train
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
reflex-dev/reflex#7260 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
ClientStateVar: a component that mounts while the value is non-default never re-renders on the push back to the defaultQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
reflex-dev/reflex#6823 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
documentation upstream
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
reflex-dev/reflex#6436 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de reflex-dev/reflex
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
superlinked/sie#1033 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
apache/ponymail-foal#365 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
NousResearch/hermes-labs-plugins#116 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
gcivil-nyu-org/team-3-fall26#192 ·
Los mantenedores suelen responder en 1 día
-
[Study plan] Study sessions can be rescheduled to any length (e.g. 72 hours) with no length checkAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
gcivil-nyu-org/team-2-fall26#159 ·
Los mantenedores suelen responder en 1 día