From 800685da6815d5aaf2fdf7d266a926d461023037 Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Mon, 29 Jul 2024 16:57:33 -0700 Subject: [PATCH] fix silly bug when style is set directly to breakpoints (#3719) * fix silly bug when style is set directly to breakpoints * add helpful comment Co-authored-by: Masen Furer --------- Co-authored-by: Masen Furer --- reflex/components/component.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reflex/components/component.py b/reflex/components/component.py index 1786dd060c..bb3e9053f2 100644 --- a/reflex/components/component.py +++ b/reflex/components/component.py @@ -24,6 +24,7 @@ import reflex.state from reflex.base import Base from reflex.compiler.templates import STATEFUL_COMPONENT +from reflex.components.core.breakpoints import Breakpoints from reflex.components.tags import Tag from reflex.constants import ( Dirs, @@ -466,6 +467,12 @@ def __init__(self, *args, **kwargs): # Merge styles, the later ones overriding keys in the earlier ones. style = {k: v for style_dict in style for k, v in style_dict.items()} + if isinstance(style, Breakpoints): + style = { + # Assign the Breakpoints to the self-referential selector to avoid squashing down to a regular dict. + "&": style, + } + kwargs["style"] = Style( { **self.get_fields()["style"].default,