Known Issues
* Unhandled runtime error when navigating between pages in a stateless app.
* Fix: https://github.com/reflex-dev/reflex/pull/2490/commits/c78884b7ba4fd30f5047e87d5b24da59475a0fef
This Release was Airdropped from 30000' over Nevada 🪂
![IMG_2840](https://github.com/reflex-dev/reflex/assets/1524005/7468742e-1dde-4704-9bd4-4a65e2eef28b)
Breaking Changes
Use `dill` instead of `cloudpickle`
In reflex-0.4.6, existing states persisted in redis are not compatible. Redis should be cleared and existing states/sessions discarded after upgrading.
* [REF-2089] Use dill instead of cloudpickle for serialization by masenf in https://github.com/reflex-dev/reflex/pull/2922
New Features
`reflex component share` CLI
Simplify sharing of custom 3rd party components to the [Reflex Component Gallery](https://reflex.dev/docs/custom-components/).
* [REF-2168] Add share options to custom component commands by martinxu9 in https://github.com/reflex-dev/reflex/pull/2883
`rx.ComponentState`
An easy way to define per-component State.
python
import reflex as rx
class CounterButton(rx.ComponentState):
count: int
def increment(self):
self.count += 1
def decrement(self):
self.count -= 1
classmethod
def get_component(cls, *children, **props):
return rx.button(
f"Counter {cls.count}",
on_click=cls.increment,
on_context_menu=cls.decrement.prevent_default,
)
counter_button = CounterButton.create
rx.page()
def index():
return rx.vstack(
*[counter_button() for _ in range(10)]
)
app = rx.App()
* [REF-2265] ComponentState: scaffold for copying State per Component instance by masenf in https://github.com/reflex-dev/reflex/pull/2923
Automatically Select Next Available Port
When the configured port is not available, automatically select the next sequential port until one is available
* added feature to automatically change port by wassafshahzad in https://github.com/reflex-dev/reflex/pull/2867
Expanding Textarea
New props on `rx.el.textarea` and `rx.text_area` allow the field to expand to match content and submit the form when Enter is pressed (shift+enter to create a new line)
* textarea: expose auto_height and enter_key_submit props by masenf in https://github.com/reflex-dev/reflex/pull/2884
`rx.scroll_to` event
Scroll the viewpoint to show a given element by ID.
* Scroll to feature by Yummy-Yums in https://github.com/reflex-dev/reflex/pull/2948
Improvements
Simplify Component Wrapping API
[REF-2272] Support declaring EventHandlers directly in component by martinxu9 in https://github.com/reflex-dev/reflex/pull/2952
Props typed as `rx.EventHandler` can be used to define event triggers without overriding `get_event_triggers` method. The argument of the type specifies the JS to Python mapping: `on_click: rx.EventTrigger[lambda e: [e]]`.
generate pyi files when building/publishing 3rd party component by Lendemor in https://github.com/reflex-dev/reflex/pull/2945
Third-party components will now have `.pyi` files generated for them to improve IDE completion, similar to the built in Reflex components.
Updated Lucide Icons
The latest icons available on https://lucide.dev are now usable in Reflex. Some icon names have changed, these will print a deprecation warning pointing to the new name. The old names will be removed in 0.5.0.
* Update LUCIDE_ICON_LIST with newest Icon names by luccavp12 in https://github.com/reflex-dev/reflex/pull/2891
Loosen Requirement Pins
Reflex is now compatible with a wider range of dependencies. Notably, it can be used with packages that depend on Pydantic v2 (although the framework itself is still using v1).
* [REF-2127] Loosen requirements by mahrz24 in https://github.com/reflex-dev/reflex/pull/2796
Note: due to a regression in recent `uvicorn` versions, that dep will remain pinned as it was in 0.4.5.
Avoid content flicker when using `State.is_hydrated`
`is_hydrated` is set to False immediately when a navigation event starts, and is set back to True after all on_load events have executed. This avoids content flickering into view before a loading spinner is displayed when the spinner is conditional on the value of `State.is_hydrated`.
Additionally, the WiFi off connection error pulser is only displayed when connection errors are detected (before it was displayed whenever the page was not hydrated).
* Set is_hydrated=False at route onChangeStart by masenf in https://github.com/reflex-dev/reflex/pull/2949
Miscellaneous
* [REF-1982] state: Warn if redis state is "too big" by masenf in https://github.com/reflex-dev/reflex/pull/2868
* use radix box instead of chakra one for responsive elements by Lendemor in https://github.com/reflex-dev/reflex/pull/2921
* [REF-2229]Dedupe deprecation warnings by ElijahAhianyo in https://github.com/reflex-dev/reflex/pull/2871
* fix hook order to use ref inside user hooks by Lendemor in https://github.com/reflex-dev/reflex/pull/2906
* Ensure user-defined hooks can always access refs
* [REF-2302] When a Var points to a model, prefer access to model fields. by masenf in https://github.com/reflex-dev/reflex/pull/2893
Bug Fixes
* [REF-2117]:`rx.color_mode_cond` to work in f-strings by ElijahAhianyo in https://github.com/reflex-dev/reflex/pull/2775
* Default to None if bun/fnm version is Invalid by ElijahAhianyo in https://github.com/reflex-dev/reflex/pull/2940
* remove inheritance from Flex for list components by Lendemor in https://github.com/reflex-dev/reflex/pull/2936
* Fix markdown rendering of lists
* parse_args_spec: resolve annotations with typing.get_type_hints by masenf in https://github.com/reflex-dev/reflex/pull/2849
* [REF-2219] Avoid refetching states that are already cached by masenf in https://github.com/reflex-dev/reflex/pull/2953
* Fix issue affecting Cookie/LocalStorage values when substates contained computed vars
* [REF-2306] Include twine in dependencies on pyproject.toml by martinxu9 in https://github.com/reflex-dev/reflex/pull/2895
Other Changes
* Fix 2877, PR title not available for push/PR merge by martinxu9 in https://github.com/reflex-dev/reflex/pull/2889
* [REF-2284]Benchmark add extra info on publishing data by ElijahAhianyo in https://github.com/reflex-dev/reflex/pull/2864
* Revert "add precommit check added large files and git lfs rules (2866)" by picklelo in https://github.com/reflex-dev/reflex/pull/2905
* [REF-1682][REF-1683][REF-1684][REF-2283]Benchmark reflex package size and .web folder by ElijahAhianyo in https://github.com/reflex-dev/reflex/pull/2880
* fix AppHarness reloading by benedikt-bartscher in https://github.com/reflex-dev/reflex/pull/2916
* Remove page.pyi: it's out of date, and not necessary by masenf in https://github.com/reflex-dev/reflex/pull/2924
* [REF-2416] Pass shell=True when starting AppHarness on Windows by masenf in https://github.com/reflex-dev/reflex/pull/2944
* updated watchdog dep by Yummy-Yums in https://github.com/reflex-dev/reflex/pull/2946
* Update README.md by ChicIceCream in https://github.com/reflex-dev/reflex/pull/2963
New Contributors
* luccavp12 made their first contribution in https://github.com/reflex-dev/reflex/pull/2891
* mahrz24 made their first contribution in https://github.com/reflex-dev/reflex/pull/2796
* ChicIceCream made their first contribution in https://github.com/reflex-dev/reflex/pull/2963
**Full Changelog**: https://github.com/reflex-dev/reflex/compare/v0.4.5...v0.4.6