wip
This commit is contained in:
parent
c721227a06
commit
02dd4a1313
@ -1288,6 +1288,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if name in self.backend_vars:
|
if name in self.backend_vars:
|
||||||
|
if self._backend_vars.get(name) == value:
|
||||||
|
return
|
||||||
|
print(f"Setting {name} to {value}.")
|
||||||
self._backend_vars.__setitem__(name, value)
|
self._backend_vars.__setitem__(name, value)
|
||||||
self.dirty_vars.add(name)
|
self.dirty_vars.add(name)
|
||||||
self._mark_dirty()
|
self._mark_dirty()
|
||||||
@ -1323,6 +1326,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Set the attribute.
|
# Set the attribute.
|
||||||
|
current_value = getattr(self, name, None)
|
||||||
|
if current_value == value:
|
||||||
|
return
|
||||||
super().__setattr__(name, value)
|
super().__setattr__(name, value)
|
||||||
|
|
||||||
# Add the var to the dirty list.
|
# Add the var to the dirty list.
|
||||||
|
@ -2164,6 +2164,7 @@ class ComputedVar(Var[RETURN_TYPE]):
|
|||||||
Args:
|
Args:
|
||||||
instance: the state instance that needs to recompute the value.
|
instance: the state instance that needs to recompute the value.
|
||||||
"""
|
"""
|
||||||
|
print(f"Marking {self._js_expr} as dirty")
|
||||||
with contextlib.suppress(AttributeError):
|
with contextlib.suppress(AttributeError):
|
||||||
delattr(instance, self._cache_attr)
|
delattr(instance, self._cache_attr)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user