Pārlūkot izejas kodu

vars: set `_was_touched` when updating cached vars (#2886)

Ensure that updated cached vars are persisted into redis.
Masen Furer 1 gadu atpakaļ
vecāks
revīzija
6a071a27e2
1 mainītis faili ar 2 papildinājumiem un 0 dzēšanām
  1. 2 0
      reflex/vars.py

+ 2 - 0
reflex/vars.py

@@ -1861,6 +1861,8 @@ class ComputedVar(Var, property):
         # handle caching
         # handle caching
         if not hasattr(instance, self._cache_attr):
         if not hasattr(instance, self._cache_attr):
             setattr(instance, self._cache_attr, super().__get__(instance, owner))
             setattr(instance, self._cache_attr, super().__get__(instance, owner))
+            # Ensure the computed var gets serialized to redis.
+            instance._was_touched = True
         return getattr(instance, self._cache_attr)
         return getattr(instance, self._cache_attr)
 
 
     def _deps(
     def _deps(