From 72f1fa7cb4ac13699079026c4b76b85c71c7c42f Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Thu, 16 Jan 2025 18:17:15 -0800 Subject: [PATCH] make the var type actually work --- reflex/vars/number.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/reflex/vars/number.py b/reflex/vars/number.py index 3090e2497..fa549b3b3 100644 --- a/reflex/vars/number.py +++ b/reflex/vars/number.py @@ -1169,14 +1169,20 @@ class MatchOperation(CachedVarOperation, Var[VAR_TYPE]): Returns: The match operation. """ + cond = Var.create(cond) cases = tuple(tuple(Var.create(c) for c in case) for case in cases) + default = Var.create(default) + var_type = _var_type or unionize( + *(case[-1]._var_type for case in cases), + default._var_type, + ) return cls( _js_expr="", _var_data=_var_data, - _var_type=_var_type, - _cond=Var.create(cond), + _var_type=var_type, + _cond=cond, _cases=cases, - _default=Var.create(default), + _default=default, )