Release Notes
NextJS back at latest version
As we have had more bugs related to the downgrade, we now have upgraded it back and disable turbopack by default. You can overwrite nextjs version with `NEXTJS_VERSION` but it is very much NOT SUPPORTED. Expect bugs when you do so.
* expose NEXTJS_VERSION and upgrade nextjs by adhami3310 in https://github.com/reflex-dev/reflex/pull/5039
* warn users about nextjs version by adhami3310 in https://github.com/reflex-dev/reflex/pull/5045
Event handlers as Vars
Not flashy, but you can use handlers in conds and such
py
on_click=rx.cond(
SnakeState.game_over,
SnakeState.start_game,
SnakeState.pause_game
)
This only works when the event handler takes no arguments, however, you should use the much more reliable:
py
on_click=rx.cond(
SnakeState.game_over,
SnakeState.start_game(),
SnakeState.pause_game()
)
Where you call the event handlers. You can use lambda syntax to provide arguments for them.
* allow event handlers to be turned into vars by adhami3310 in https://github.com/reflex-dev/reflex/pull/5032
Expose Socket constants for further customizability
Exposes `REFLEX_SOCKET_MAX_HTTP_BUFFER_SIZE`, `REFLEX_SOCKET_INTERVAL`, `REFLEX_SOCKET_TIMEOUT` to be modified.
* expose socket constants by adhami3310 in https://github.com/reflex-dev/reflex/pull/5022
Add support for ndigits for dunder method __round__ for int vars
py
round(State.int_field, 3)
* add ndigits to round dunder method by adhami3310 in https://github.com/reflex-dev/reflex/pull/5019
Expose run_in_thread
`rx.run_in_thread` is a simple wrapper around asyncio to run a function in a different thread.
* promote run_in_thread from experimental by Lendemor in https://github.com/reflex-dev/reflex/pull/5016
Allow `None` as children of components
Previously we errored, but now we allow it, it doesn't render to anything.
* allow none as a child of components by adhami3310 in https://github.com/reflex-dev/reflex/pull/5043
Allow arguments for rx.memo event handlers
py
rx.memo
def counter(on_text: rx.EventHandler[rx.event.passthrough_event_spec(str)]):
return rx.hstack(
rx.button("Increment", on_click=on_text("Increment")),
rx.button("Decrement", on_click=on_text("Decrement")),
)
def index():
return rx.vstack(rx.text("Counter"), counter(on_text=rx.console_log))
You can even define your own event spec
py
def hello_who(who: rx.Var[str]) -> tuple[rx.Var[str]]:
return (rx.Var.create(f"Hello, {who}!"),)
rx.memo
def counter(on_text: rx.EventHandler[hello_who]):
return rx.hstack(
rx.button("Masen", on_click=on_text("Masen")),
rx.button("Not Masen", on_click=on_text("Not Masen")),
)
def index():
return rx.vstack(rx.text("Who Are You?"), counter(on_text=rx.console_log))
* allow arguments to be passed to rx memo event handlers by adhami3310 in https://github.com/reflex-dev/reflex/pull/5021
Bugfixes
* load script directory from config [ENG-5131] by adhami3310 in https://github.com/reflex-dev/reflex/pull/5020
* copy styles to the correct dir by masenf in https://github.com/reflex-dev/reflex/pull/5024
* fix wrong domain for gallery backend by adhami3310 in https://github.com/reflex-dev/reflex/pull/5036
* make sure to str the value in console log by adhami3310 in https://github.com/reflex-dev/reflex/pull/5030
* use package path for dynamic icon by adhami3310 in https://github.com/reflex-dev/reflex/pull/5028
* use granian features to improve hot reload by adhami3310 in https://github.com/reflex-dev/reflex/pull/5023
* Khaleel/eng 5281 typeerror unsupported type ellipsis for guess type by adhami3310 in https://github.com/reflex-dev/reflex/pull/5046
* fix cert errors for package install by adhami3310 in https://github.com/reflex-dev/reflex/pull/5050
Chores
* bump to 0.7.5dev by adhami3310 in https://github.com/reflex-dev/reflex/pull/5018
* Improve AppHarness behavior when app already exists in a relative directory by masenf in https://github.com/reflex-dev/reflex/pull/5025
* make test_call_script more reliable by adhami3310 in https://github.com/reflex-dev/reflex/pull/5038
* add integration test for icons by adhami3310 in https://github.com/reflex-dev/reflex/pull/5037
* make pyright happier by adhami3310 in https://github.com/reflex-dev/reflex/pull/5006
* fix iter parent class method by Lendemor in https://github.com/reflex-dev/reflex/pull/5044
**Full Changelog**: https://github.com/reflex-dev/reflex/compare/v0.7.4...v0.7.5