You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Negating a var using not v does not work.
To Reproduce
For example, creating a var in State is_false: bool = False and then using rx.cond(not State.is_false, rx.text("negated"), rx.text("not negated")). It always shows the text not negated.
Expected behavior
I expected the var to be correctly negated.
Specifics:
Python Version: 3.11.5
Reflex Version: 0.2.6
OS: macOS 13.5.1 (22G90)
Browser (Optional): Arc; version 1.6.0 (41215)
Additional context
It works using ~State.is_false but it would me more user-friendly if it works using not.
The text was updated successfully, but these errors were encountered:
Yeah unfortunately we will have to close this, since it's not currently possible without AST manipulation, which we're not getting into at this point.
I implemented #1750 which will raise a TypeError when trying to use a Var with if, and, or or not and suggest the use of our alternative operations. That will have to be enough for now.
Describe the bug
Negating a var using
not v
does not work.To Reproduce
For example, creating a var in State
is_false: bool = False
and then usingrx.cond(not State.is_false, rx.text("negated"), rx.text("not negated"))
. It always shows the textnot negated
.Expected behavior
I expected the var to be correctly negated.
Specifics:
Additional context
It works using
~State.is_false
but it would me more user-friendly if it works usingnot
.The text was updated successfully, but these errors were encountered: