Computed Var Dependency Tracking Limits
0 reputation · 13 Aug 2020, 20:14 UTC
0 reputation · 13 Aug 2020, 20:14 UTC
Reflex caches computed variable values based on declared dependencies within the State class.
Computed vars relying on external inputs, such as system clocks or file contents, do not register these inputs as dependencies.
What is the intended behavior regarding cache invalidation for computed vars dependent on non-State inputs?
The intended behavior is that a computed variable recomputes only when any of its declared State dependencies change; external inputs such as system clocks or file contents are not tracked, so the cache will not update unless a State variable that the computed variable reads is mutated.
Because Reflex’s computed var system observes reads of State variables during evaluation, it cannot detect changes in non‑State sources; therefore cache invalidation is tied to State mutations, not to time or external file changes.
Date.now() (or a file‑reading placeholder).invalidate or refresh method on the computed var object.Please confirm the Reflex version you are using, as cache‑invalidation APIs may differ between releases.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.