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 <m_github@0x26.net> --------- Co-authored-by: Masen Furer <m_github@0x26.net>
This commit is contained in:
parent
4cdd87d851
commit
800685da68
@ -24,6 +24,7 @@ from typing import (
|
|||||||
import reflex.state
|
import reflex.state
|
||||||
from reflex.base import Base
|
from reflex.base import Base
|
||||||
from reflex.compiler.templates import STATEFUL_COMPONENT
|
from reflex.compiler.templates import STATEFUL_COMPONENT
|
||||||
|
from reflex.components.core.breakpoints import Breakpoints
|
||||||
from reflex.components.tags import Tag
|
from reflex.components.tags import Tag
|
||||||
from reflex.constants import (
|
from reflex.constants import (
|
||||||
Dirs,
|
Dirs,
|
||||||
@ -466,6 +467,12 @@ class Component(BaseComponent, ABC):
|
|||||||
# Merge styles, the later ones overriding keys in the earlier ones.
|
# 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()}
|
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(
|
kwargs["style"] = Style(
|
||||||
{
|
{
|
||||||
**self.get_fields()["style"].default,
|
**self.get_fields()["style"].default,
|
||||||
|
Loading…
Reference in New Issue
Block a user