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
Trying to use an rx.match within an f-string causes a failed to compile error that shows up in the browser, but no sign of issues during compiling.
To Reproduce
Steps to reproduce the behavior:
importreflexasrx@rx.page('/')defindex():
returnrx.text(f'Error with match as part of fstring: {rx.match("a", ("a", "Matched a"), "b")}')
# return rx.text(f'No error if outside fstring: ', rx.match("a", ("a", "Matched a"), "b"))
Adding .to(str) or .to_string() to the rx.match also results in the same error in case that is relevant.
The easy alternative is to just separate the rx.match from the string, but this is only easy once you figure out what the problem is in the first place....
Expected behavior
Given that other rx.Vars can be used within an f-string, and that rx.match can often be used where an rx.Var would be used (e.g. setting prop values) I would have expected rx.match to also work within an f-string.
Took me quite a while to realise what the error message was telling me because the point of error appears to be within the rx.match component, but of course the real issue is that the whole thing is sort of being treated as a string.
I don't think this necessarily needs to be supported, but would be nice to get a more helpful error :)
Screenshots
Specifics (please complete the following information):
Python Version: 3.11
Reflex Version: 4.9
OS: WSL2
Browser (Optional): Chrome
The text was updated successfully, but these errors were encountered:
Describe the bug
Trying to use an
rx.match
within an f-string causes afailed to compile
error that shows up in the browser, but no sign of issues during compiling.To Reproduce
Steps to reproduce the behavior:
Adding
.to(str)
or.to_string()
to therx.match
also results in the same error in case that is relevant.The easy alternative is to just separate the rx.match from the string, but this is only easy once you figure out what the problem is in the first place....
Expected behavior
Given that other
rx.Var
s can be used within an f-string, and that rx.match can often be used where an rx.Var would be used (e.g. setting prop values) I would have expectedrx.match
to also work within an f-string.Took me quite a while to realise what the error message was telling me because the point of error appears to be within the rx.match component, but of course the real issue is that the whole thing is sort of being treated as a string.
I don't think this necessarily needs to be supported, but would be nice to get a more helpful error :)
Screenshots
Specifics (please complete the following information):
The text was updated successfully, but these errors were encountered: