overload equals to special case immutable var

This commit is contained in:
Khaleel Al-Adhami 2024-08-12 15:59:26 -07:00
parent 5bfc0c0446
commit 0fd423712b

View File

@ -765,6 +765,16 @@ class Var:
Returns:
Whether the vars are equal.
"""
from reflex.ivars import ImmutableVar
if isinstance(other, ImmutableVar) or isinstance(self, ImmutableVar):
return (
self._var_name == other._var_name
and self._var_type == other._var_type
and ImmutableVarData.merge(self._var_data)
== ImmutableVarData.merge(other._var_data)
)
return (
self._var_name == other._var_name
and self._var_type == other._var_type