-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
computed var default to cache=True #4194
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we actually make the signature cache: bool = None
then in ComputedVar.__init__
, we can check if cache is None
and throw a deprecation warning, keeping the default as False
until 0.7.0; then we remove the warning and replace the None
default with True
.
If users want to get rid of the warning, then they will need an explicit value for the cache
parameter.
The main downside with this approach is that @rx.var
decoration (with no parentheses) will raise the deprecation warning until 0.7.0 is released... maybe that's not ideal
marking as draft to avoid accidentally merging a behavior-changing PR |
I'm updating this PR in preparation for 0.7.0, do you still want any of those change to it? |
@Lendemor if we haven't been warning users that this behavior will change in 0.7.0, i think we should merge a patch for our next release that does as i suggested back in october and print a warning when the user does not provide an explicit boolean for the |
Set the default value of
cache
toTrue
for@rx.var
Lead to better performance "out of the box" since any computed var will be cached, unless explicitly disabled.
Potentially breaking some apps behaviour, so we are considering delaying this PR to
0.7.0
.