`rx.match` doesn't work within f-string
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:
import reflex as rx
@rx.page('/')
def index():
return rx.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
Same for rx.cond as well:
import reflex as rx
@rx.page('/')
def index():
return rx.text(f'Error with match as part of fstring: {rx.cond(True, "value1", "value2")}')
This is solved in 0.6.0.