Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyi_hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"reflex/components/radix/primitives/slider.pyi": "10196fb967c9cde3860a930a526b6c51",
"reflex/components/radix/themes/__init__.pyi": "a15f9464ad99f248249ffa8e6deea4cf",
"reflex/components/radix/themes/base.pyi": "a3c3c3b72fd3d8f1e38990e5c461b682",
"reflex/components/radix/themes/color_mode.pyi": "435a51382eab6111aae1b26e79e9a473",
"reflex/components/radix/themes/color_mode.pyi": "e18fe42952d10f5733f3baf4789c4bb5",
"reflex/components/radix/themes/components/__init__.pyi": "87bb9ffff641928562da1622d2ca5993",
"reflex/components/radix/themes/components/alert_dialog.pyi": "8e1dde62450296310a116ed066bd51e3",
"reflex/components/radix/themes/components/aspect_ratio.pyi": "1845813a034adfc1f5db8e0f6ffc1118",
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/radix/themes/color_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,5 @@ class ColorModeNamespace(Var):
color_mode = color_mode_var_and_namespace = ColorModeNamespace(
_js_expr=color_mode._js_expr,
_var_type=color_mode._var_type,
_var_data=color_mode._get_default_value(),
_var_data=color_mode._get_all_var_data(),
)
16 changes: 15 additions & 1 deletion reflex/vars/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,21 @@ class ToVarOperation(ToOperation, cls):
_var_subclasses.append(VarSubclassEntry(cls, ToVarOperation, python_types))

def __post_init__(self):
"""Post-initialize the var."""
"""Post-initialize the var.

Raises:
TypeError: If _js_expr is not a string.
"""
if not isinstance(self._js_expr, str):
raise TypeError(
f"Expected _js_expr to be a string, got value {self._js_expr!r} of type {type(self._js_expr).__name__}"
)

if self._var_data is not None and not isinstance(self._var_data, VarData):
raise TypeError(
f"Expected _var_data to be a VarData, got value {self._var_data!r} of type {type(self._var_data).__name__}"
)

# Decode any inline Var markup and apply it to the instance
_var_data, _js_expr = _decode_var_immutable(self._js_expr)

Expand Down
Loading