clear cache on add style recursive

This commit is contained in:
Khaleel Al-Adhami 2025-01-31 14:38:23 -08:00
parent 1bb8ba5585
commit aef6aced03
3 changed files with 7 additions and 10 deletions

View File

@ -689,8 +689,6 @@ class ExecutorSafeFunctions:
component, enable_state = compile_unevaluated_page(
route, cls.UNCOMPILED_PAGES[route]
)
component = component if isinstance(component, Component) else component()
component._add_style_recursive(style, theme)
return route, component, compile_page(route, component, cls.STATE)
@classmethod

View File

@ -9,7 +9,7 @@ from reflex.components.tags import Tag
from reflex.components.tags.tagless import Tagless
from reflex.utils.imports import ParsedImportDict
from reflex.vars import BooleanVar, ObjectVar, Var
from reflex.vars.base import VarData
from reflex.vars.base import GLOBAL_CACHE, VarData
class Bare(Component):
@ -161,6 +161,8 @@ class Bare(Component):
if isinstance(component, Component):
component._add_style_recursive(style, theme)
GLOBAL_CACHE.clear()
return new_self
def _get_vars(

View File

@ -1445,9 +1445,9 @@ def test_unsupported_types_for_reverse(var):
Args:
var: The base var.
"""
with pytest.raises(TypeError) as err:
with pytest.raises(AttributeError) as err:
var.reverse()
assert err.value.args[0] == "Cannot reverse non-list var."
assert err.value.args[0] == "'Var' object has no attribute 'reverse'"
@pytest.mark.parametrize(
@ -1465,12 +1465,9 @@ def test_unsupported_types_for_contains(var: Var):
Args:
var: The base var.
"""
with pytest.raises(TypeError) as err:
with pytest.raises(AttributeError) as err:
assert var.contains(1) # pyright: ignore [reportAttributeAccessIssue]
assert (
err.value.args[0]
== f"Var of type {var._var_type} does not support contains check."
)
assert err.value.args[0] == "'Var' object has no attribute 'contains'"
@pytest.mark.parametrize(