Skip to content

Commit ba17e06

Browse files
committed
memoized theme switcher
1 parent ec6b6a6 commit ba17e06

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ fail_fast: true
22

33
repos:
44
- repo: https://github.com/astral-sh/ruff-pre-commit
5-
rev: v0.12.5
5+
rev: v0.12.7
66
hooks:
77
- id: ruff-check
88
files: ^reflex_ui/

reflex_ui/components/base/theme_switcher.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def theme_switcher_item(mode: LiteralColorMode, icon: str) -> Component:
2424
)
2525

2626

27-
@memo
2827
def theme_switcher(class_name: str = "") -> Component:
2928
"""Theme switcher component."""
3029
return Div.create(
@@ -36,3 +35,9 @@ def theme_switcher(class_name: str = "") -> Component:
3635
class_name,
3736
),
3837
)
38+
39+
40+
@memo
41+
def memoized_theme_switcher(class_name: str = "") -> Component:
42+
"""Memoized theme switcher component."""
43+
return theme_switcher(class_name=class_name)

0 commit comments

Comments
 (0)