Releases: reflex-dev/reflex
v0.6.3.post1
Post-release fix for hot reload issue RuntimeError: Cannot populate parent states
- [ENG-3989] Ensure non-serialized states are present in StateManagerDisk (#4230)
Full Changelog: v0.6.3...v0.6.3.post1
v0.6.3
New Features
Correct handling of aria
and data
props
Any props passed to a component with aria_
or data_
prefix will be applied directly to the component (previously, these were misinterpreted as style props).
Reflex Code
rx.icon_button("save", aria_label="Save Changes", data_test="arbitrary data")
Generated Output
<button ... aria-label="Save Changes" data-test="arbitrary data"><svg>...</svg></button>
Improvements
Static typing of events and vars
New (optional) rx.Field
, rx.field
and @rx.event
decorators allow pyright and other static type checkers to better understand how event handlers and state vars are handled in reflex, allowing most static type checking to pass without # type: ignore
comments.
import reflex as rx
class MyState(rx.State):
v: rx.Field[int] = rx.field(42)
@rx.event
def set_v(self, v: str):
try:
self.v = int(v)
except ValueError:
pass
def index() -> rx.Component:
return rx.vstack(
rx.heading(MyState.v),
rx.input(
value=MyState.v,
on_change=MyState.set_v,
type="number",
),
)
app = rx.App()
app.add_page(index)
- [ENG-3749] type safe vars by @adhami3310 in #4066
- add type hinting to events by @adhami3310 in #4145
Other Improvements
- Optimize StateManagerDisk by @masenf in #4056
- Reduce pickle size by @masenf in #4063
- fail safely when pickling by @adhami3310 in #4085
- First use environment variable as npm registry by @ruhz3 in #4082
- let users pick state manager mode by @Lendemor in #4041
- Allow setting a different invocation function for EventChain by @masenf in #4160
Bug Fixes
- convert literal type to its variants by @adhami3310 in #4062
- catch CancelledError in lifespan hack for windows by @Lendemor in #4083
- Get default for backend var defined in mixin by @masenf in #4060
- [ENG-3903] bundle next link in window by @adhami3310 in #4064
- misc var improvements by @adhami3310 in #4068
- [ENG-2287] Avoid fetching same state from redis multiple times by @masenf in #4055
- reset backend vars in state.reset() by @adhami3310 in #4087
- fix custom component init by @Lendemor in #4123
- use system npm when REFLEX_USE_SYSTEM_NODE is passed by @adhami3310 in #4133
- Remove wrong event handlers by @adhami3310 in #4136
- fix: Determine str type from value. by @abulvenz in #4143
- remove dictify from state dict by @adhami3310 in #4141
- catch ValueError("I/O operation on closed file.") if frontend crashes by @benedikt-bartscher in #4150
- fix union types for vars by @adhami3310 in #4152
- Change bun link by @adhami3310 in #4162
- change bun install link to main by @adhami3310 in #4164
- only load json if it's not empty by @adhami3310 in #4165
- Handle rx.State subclasses defined in function by @masenf in #4129
- Do not auto-determine generic args if already supplied by @benedikt-bartscher in #4148
- unionize base var fields types by @adhami3310 in #4153
- [ENG-3954] Treat ArrayVar.foreach index as int (#4193)
- LiteralEventChainVar becomes an ArgsFunctionOperation (#4174)
- only treat dict object vars as key value mapping (#4177)
Version Bumps
- add workflow to check dependencies on release branch by @Lendemor in #4050
- upgrade default node to current lts by @adhami3310 in #4086
- update ruff to latest version by @Lendemor in #4081
- Revert Markdown-related frontend dep bumps by @masenf in #4088
- pin AppHarness tests to ubuntu-22.04 runner (#4173)
Documentation
- default props comment for CartesianAxis by @carlosabadia in #4127
- default props comment for CartesianGrid by @carlosabadia in #4126
- default props comment for ReferenceLine by @carlosabadia in #4122
- default props comment for ReferenceArea by @carlosabadia in #4124
- default props comment for Scatter by @carlosabadia in #4118
- default props comment for Area by @carlosabadia in #4115
- default props comment for Line by @carlosabadia in #4117
- default props comment for Bar by @carlosabadia in #4116
- default props comment for Brush by @carlosabadia in #4113
- default props comment for ZAxis by @carlosabadia in #4112
- default props comment for YAxis by @carlosabadia in #4111
- default props comment for XAxis by @carlosabadia in #4110
- default props comment for Legend by @carlosabadia in #4100
- default props comment for PolarAngleAxis by @carlosabadia in #4106
- default props comment for LabelList by @carlosabadia in #4102
- default props comment for treemap by @carlosabadia in #4098
- default props comment for ResponsiveContainer by @carlosabadia in #4099
- default props comment for scatterchart by @carlosabadia in #4096
- default props comment for radarchart by @carlosabadia in #4094
- default props comment for radialbarchart by @carlosabadia in #4095
- default props comment for barchart by @carlosabadia in #4092
- default props comment for composedchart by @carlosabadia in #4093
- areachart default value for base_value by @carlosabadia in #4090
- default props comment for categoricalchartbase by @carlosabadia in #4091
- default props comment for PolarGrid by @carlosabadia in #4107
- default props comment for Reference by @carlosabadia in #4121
- default props comment for funnelchart by @carlosabadia in #4097
- default props comment for Radar by @carlosabadia in #4104
- Add Vietnamese README docs by @nguyenmphu in #4138
- fix docstring by @benedikt-bartscher in #4140
- default props comment for Grid by @carlosabadia in #4125
- default props comment for Funnel by @carlosabadia in #4119
- default props comment for ErrorBar by @carlosabadia in #4120
- default props comment for Cartesian by @carlosabadia in #4114
- default props comment for RadialBar by @carlosabadia in #4105
- default props comment for PolarRadiusAxis by @carlosabadia in #4108
- default props comment for Pie by @carlosabadia in #4103
- default props comment for Axis by @carlosabadia in #4109
Other Changes
- test_dynamic_routes: log on_loads and poll for 60 seconds on order by @masenf in #4089
- only run macOS job on merge by @Lendemor in #4139
- Change the defalut direction of radio group by @Manojvbhat in #4146
New Contributors
- @nguyenmphu made their first contribution in #4138
- @ruhz3 made their first contribution in #4082
- @Manojvbhat made their first contribution in https://github.co...
v0.6.2.post1
Hotfix for Upload
Pin attr-accept
package to 2.2.2 to avoid breakage introduced in 2.2.3 (Released 2024-10-09)
Full Changelog: v0.6.2...v0.6.2.post1
v0.6.2
Known Issues
There is an error persisting states that are created inside a function #4128
def dynamic_state():
class _DynamicState(rx.State):
dynamic: str = ""
return _DynamicState
DynamicState = dynamic_state()
AttributeError: Can't pickle local object 'dynamic_state.<locals>._DynamicState'
Improvements
- All SVG elements are now supported
- feat: Add support for missing SVGs by @ChinoUkaegbu in #3962
- Event triggers can now use
rx.cond
- support eventspec/eventchain in var operations by @adhami3310 in #4038
- Faster state serialization by replacing
dill
with normalpickle
Bug Fixes
- Handle
primary_key
defined insa_column
- [ENG-3870] rx.call_script with f-string var produces incorrect code by @masenf in #4039
- Get default for backend var defined in mixin (#4060)
- catch CancelledError in lifespan hack for windows (#4083)
- convert literal type to its variants (#4062)
Dynamic Components
- Use an equality check instead of startswith by @masenf in #4024
- add of_type to _evaluate by @adhami3310 in #4051
- bundle chakra in window for CSR by @adhami3310 in #4042
- Include emotion inside of dynamic components by @adhami3310 in #4052
Error Messages
- improve granian error message when not installed by @Lendemor in #4037
- [ENG-3476]Setting State Vars that are not defined should raise an error by @ElijahAhianyo in #4007
- set loglevel to info with hosting cli by @adhami3310 in #4043
- default should be warning for subprocesses not info by @adhami3310 in #4049
- remove var operation error by @adhami3310 in #4053
Other Changes
- use pathlib as much as possible by @Lendemor in #3967
- Track the last reflex run time by @ElijahAhianyo in #4045
- move router dataclasses in their own file by @Lendemor in #4044
New Contributors
- @ChinoUkaegbu made their first contribution in #3962
- @Kastier1 made their first contribution in #4021
Full Changelog: v0.6.1...v0.6.2
v0.6.1
Regression Fixes
- re add removed method with better behaviour and tests by @Lendemor in #3986
- hash the state file name by @adhami3310 in #4000
- EventFnArgMismatch fix to support defaults args by @LeoGrosjean in #4004
- serialize default value for disk state manager by @adhami3310 in #4008
- remove format_state and override behavior for bare by @adhami3310 in #3979
- Handle bool cast for optional NumberVar by @masenf in #4010
- use literal var instead of serialize for toast props by @adhami3310 in #4027
New Features
Experimental Dynamic Components
In this release, state vars can be of rx.Component
type and @rx.var
computed vars can return rx.Component
, allowing dynamic component structures to be created on the backend at runtime. This enables the full use of python expressions in generated components, as opposed to rx.cond
and rx.foreach
.
There are performance implications when using dynamic components so prefer static components where possible.
- Component as Var type by @masenf in #3732
- add basic integration test for dynamic components by @adhami3310 in #3990
- use bundled radix ui for dynamic components by @adhami3310 in #3993
- implement _evaluate in state by @adhami3310 in #4018
Run Backend with Granian server
install granian
package and set REFLEX_USE_GRANIAN=1
to run with the new, experimental granian backend (instead of the default uvicorn).
- can run with granian by setting REFLEX_USE_GRANIAN var by @Lendemor in #3919
- change loglevel and fix granian on linux by @adhami3310 in #4012
REFLEX_USE_SYSTEM_NODE
and REFLEX_USE_SYSTEM_BUN
If you prefer to run your own versions of node
and bun
, ensure they are on the PATH
and set these environment variables to 1
.
Improvements
Bump nextjs to 14.2.13
Miscellaneous
- [ENG-3717] [flexgen] Initialize app from refactored code by @masenf in #3918
- Added fill color for progress by @wassafshahzad in #3926
- Use tailwind typography plugin by default by @minimav in #3593
- disable prose by default for rx.html by @adhami3310 in #4001
- use
class_name="prose"
to enable default formatting forrx.html
- allow link as metatags by @Lendemor in #3980
- allow classname to be state vars by @adhami3310 in #3991
- default on_submit in form set to prevent_default by @Lendemor in #4005
Bug Fixes
- [ENG-3824]Make AI template use light mode by @ElijahAhianyo in #3963
- don't camel case keys of dicts in style by @adhami3310 in #3982
- add missing message when running in backend_only by @Lendemor in #4002
- [ENG-3849] Track backend-only vars that are declared without a default value by @masenf in #4016
- improve lifespan typecheck and debug by @Lendemor in #4014
Documentation
- fix: Adding in-line comments for the segmented control: value and on_change by @elviskahoro in #3933
- fix: Adding code comments for segmented control type by @elviskahoro in #3935
Other Changes
- add some unit tests for coverage by @Lendemor in #3947
- always print passed_type by @adhami3310 in #3950
- remove unused badge by @Lendemor in #3955
- add some more tests by @Lendemor in #3965
- use svg elements instead of raw html for logo by @Lendemor in #3978
- bump to 0.6.1 for further dev by @masenf in #3995
- reorganize all tests in a single top folder by @Lendemor in #3981
- Update markdown component map to use new rx.code_block.theme enum by @masenf in #3996
- remove all runtime asserts by @Lendemor in #4019
New Contributors
- @minimav made their first contribution in #3593
- @LeoGrosjean made their first contribution in #4004
Full Changelog: v0.6.0...v0.6.1
v0.6.0
Overview of Changes from 0.5.0 to 0.6.0
Breaking Changes
Drop support for python 3.8
Remove Deprecated Features
rx.input.root
(0.5.0)rx.Component._apply_theme
(0.5.0)_type
,_min
,_max
prop rewriting (0.4.0)- Passing props to rx.foreach (0.5.0)
rx.el
aliases fordefs
,lineargradient
,stop
,path
(userx.el.svg
namespace)- Lucide icons that were removed upstream (0.4.6)
- passing children to
rx.color_mode.button
(0.5.0) rx.cached_var
(0.5.6)- Specifying
REDIS_URL
without a url scheme (0.3.6)
PRs
- [REF-3568][REF-3569]Remove deprecations by @ElijahAhianyo in #3852
- [REF-3570] Remove deprecated REDIS_URL syntax by @masenf in #3892
New Var System
A Var
is a placeholder for a value which is sent to the frontend or rendered as Javascript code in the app. Most users of Reflex do not interact with the var system directly, but it becomes relevant for advanced users that are wrapping components or handling custom types.
rx.Var.create(...)
now returns aLiteralVar
subclass wrapping the provided value._var_is_string
is deprecated, passing a string will always create aStringVar
rx.Var(...)
returns anImmutableVar
representing a raw javascript expression.- Replaces the deprecated
_var_is_local
param
- Replaces the deprecated
- Vars are not automatically cast as
bool
, when passing a non-bool var to a prop that expects a boolean, add.bool()
after the var -- error message will include this hint.
The new Var
system brings a much more accurate translation of literal python values into javascript, especially of object and array types.
rx.chakra
removed from main repo
First, pip install reflex-chakra
. Then import reflex_chakra as rc
. rx.chakra
will still work until 0.7.0, but it is recommended to move now to avoid deprecation warning.
- Upper bound for reflex-chakra dependency by @masenf in #3824
- [REF-3566]Remove demo template by @ElijahAhianyo in #3888
- [REF-3562][REF-3563] Replace chakra usage (#3872)
Var Shadowing Detection
When a dynamic route arg name conflicts with the name of an existing state Var, the framework will raise DynamicRouteArgShadowsStateVar
. This is intended to avoid unexpected behavior wherein the dynamic var takes precedence over the state var, even in a substate. A fix for the underlying cause is forthcoming.
In the meantime, define any pages that use dynamic route arguments early, so the dynamic var is available for use in the page functions.
- Dynamic route vars silently shadow all other vars by @benedikt-bartscher in #3805
- cleanup dead test code by @benedikt-bartscher in #3909
When a computed var name conflicts with the name of an existing state Var, the framework will raise ComputedVarShadowsStateVar
.
- Forbid Computed var shadowing by @benedikt-bartscher in #3843
- remove reference to computed var by @adhami3310 in #3906
rx.progress
is now Radix Themes Progress
The previous Radis Primitives progress is available as rx.radix.primitives.progress
- [REF-3592]Promote
rx.progress
from radix themes by @ElijahAhianyo in #3878
Watchfiles dependency removed
If you are upgrading reflex in an existing environment run pip uninstall watchfiles
first to ensure the hot reload mechanism is properly ignoring the .web
directory.
New Features
DiskStateManager
- preserve state across hot reloads in dev mode
- implement disk state manager by @adhami3310 in #3826
- Disk state manager don't use byref by @picklelo in #3874
- delete states if it exists on run by @adhami3310 in #3901
/_health
endpoint
http://localhost:8000/_health
{"status":true,"db":true,"redis":false}
- /health endpoint for K8 Liveness and Readiness probes by @samarth9201 in #3855
Improvements
- improve state hierarchy validation, drop old testing special case by @benedikt-bartscher in #3894
- fix var dependency dicts by @benedikt-bartscher in #3842
- Update docker-example by @masenf in #3324
- use current version as default for new custom components (#3957)
Var System
- fully migrate vars into new system by @adhami3310 in #3743
- guess_type: if the type is optional, treat it like it's "not None" by @masenf in #3839
- Fix double-quoting of defaultColorMode by @masenf in #3840
- ImmutableVar perf optimizations by @masenf in #3814
- Get attribute access type fix by @benedikt-bartscher in #3803
- fix var in bare by @adhami3310 in #3873
- add var_operation and move some operations to the new style by @adhami3310 in #3841
- Adding array to array pluck operation. by @abulvenz in #3868
- simplify ImmutableComputedVar.get by @benedikt-bartscher in #3902
- Use old serializer system in LiteralVar by @adhami3310 in #3875
- Fix type propagation in ToStringOperation by @abulvenz in #3895
- [ENG-3833] handle object in is bool (#3974)
- suggest bool() for wrong values (#3975)
- use is true for bool var (#3973)
- Add shim for
format_event_chain
(#3958) - use serializer before serializing base yourself (#3960)
- [ENG-3817] deprecate _var_name_unwrapped (instead of removing it) (#3951)
- move the filterwarning to appropriate file (#3952)
- fix unionize recursion (#3948)
- add special handling for infinity and nan (#3943)
- use is true (#3946)
- use serializer for state update and rework serializers (#3934)
- replace old var system with immutable one (#3916)
- Remove Pydantic from some classes (#3907)
Documentation / Error Messages
- Add comments to DataList components by @elviskahoro in #3827
- [REF-3589] raise EventHandlerArgMismatch when event handler args don't match spec by @masenf in #3853
- better errors in state.py (#3929)
Other Changes
- Fix benchmark tests by @ElijahAhianyo in #3822
- [REF-3416] [REF-3632] Update fastapi, gunicorn, watchdog deps by @masenf in #3859
- Remove watchfiles and watchdog [REF-2133] [REF-3694] by @picklelo in #3862
Bug Fixes
- [REF-3597]Type check Radio items by @ElijahAhianyo in #3856
- Bug fix rx.toast. Allow passing
title
kwarg by @TimChild in #3857 - Update find_replace by @samarth9201 in #3886
- Use correct flexgen backend URL by @masenf in #3891
- gitignore .web by @benedikt-bartscher in #3885
- [bugfix] Allow scroll in text_area when limited by max_height by @VishDev12 in #3882
- Retain mutability inside
async with self
block by @masenf in #3884 - Include child imports in markdown component_map by @masenf in #3883
- mixin computed vars should only be applied to highest level state in β¦ by @benedikt-bartscher in #3833
- fix initial state without cv fallback by @benedikt-bartscher in #3670
- add fragment to foreach by @adhami3310 in #3877
- fix set value logix for client state (#3966)
- [0.6.0 blocker] state: update inherited_vars and tracking dicts when adding vars (#2822)
- fix template fetch during init (#3932)
- Fix string color (#3922)
New Contributors
- @elviskahoro made their first contribution in #3827
- @TimChild made their first contribution in #3857
- @samarth9201 made their first contribution in #3855
- @VishDev12 made their first contribution in #3882
Full Changelog: v0.5.10...v0.6.0
v0.5.10
Improvements
- add message when installing requirements.txt is needed for chosen template during init by @Lendemor in #3750
- use different registry when in china, fixes #3700 by @adhami3310 in #3702
- [REF-3536][REF-3537][REF-3541]Move chakra components into its repo(reflex-chakra) by @ElijahAhianyo in #3798
- Preparing for the eventual removal of chakra from the core reflex package
- Recognize
SSL_NO_VERIFY=1
to disable certificate verification when downloading tools likebun
andfnm
#3846
Bug Fixes
- #3752 bugfix add domain for XAxis by @dimritium in #3764
- fix appharness app_source typing by @benedikt-bartscher in #3777
- fix import clash between connectionToaster and hooks.useState by @Lendemor in #3749
- do not reload compilation if using local app in AppHarness by @Lendemor in #3790
- [REF-3334]Validate Toast Props by @ElijahAhianyo in #3793
- fix get_uuid_string_var by @dimritium in #3795
- minor State cleanup by @benedikt-bartscher in #3768
- Fix code wrap in markdown by @Alek99 in #3755
Other Changes
New Contributors
- @dimritium made their first contribution in #3764
Full Changelog: v0.5.9...v0.5.10
v0.5.9
Bug Fixes
- fix silly bug when style is set directly to breakpoints by @adhami3310 in #3719
- Fix event actions like
stop_propagation
for recharts event triggers - fix initial_value for computed_var by @benedikt-bartscher in #3726
- add test for initial state dict by @benedikt-bartscher in #3727
- Improve Client-Side Routing on Page Not Found by @Manas1820 in #3723
- Use the new state name when setting
is_hydrated
to false by @masenf in #3738 - Use
._is_mutable()
to account for parent state proxy by @masenf in #3739
Doc Updates
Var Refactor
This release includes some new experimental features being developed incrementally in reflex._x.vars.
- [REF-3328] Implement getitem for ArrayVar by @adhami3310 in #3705
- add type hinting to existing types by @adhami3310 in #3729
Full Changelog: v0.5.8...v0.5.9
v0.5.8
New Features
Improvements
- Recharts Improvements
- [REF-3273]Add SVG circle, polygon and rect components by @ElijahAhianyo in #3684
- notifying frontend about backend error looks better by @Lendemor in #3491
Bug Fixes
- debounce: pass through key and special_props by @masenf in #3655
- [REF-3135]Radix Primitive components should not ignore provided
class_name
prop by @ElijahAhianyo in #3676 - [REF-3101]
rx.list
Dont set/hardcodelist_style_position
css prop by @ElijahAhianyo in #3695 - [REF-3184] [REF-3339] Background task locking improvements by @masenf in #3696
- [REF-3375] useMemo on generateUUID props to maintain consistent value by @masenf in #3708
- Define BaseVar fields on ComputedVar by @paoloemilioserra in #3659
Var Refactor
This release includes some new experimental features being developed incrementally in reflex._x.vars.
- [REF-3222] define new JS-type var classes by @adhami3310 in #3668
- [REF-3228] implement LiteralStringVar and format/retrieval mechanism by @adhami3310 in #3669
- [REF-3227] implement more literal vars by @adhami3310 in #3687
- [REF-3321] implement var operation decorator by @adhami3310 in #3698
Other Changes
- cleanup unused useReducer import by @benedikt-bartscher in #3667
- feat: Improve documentation in Japanese README.md file by @l-melon in #3650
- Benchmarking Updates by @Alek99 in #3680
- add Persian translation and update the language links in the README.m⦠by @BenyaminZojaji in #3666
- fix var warning by @Lendemor in #3704
New Contributors
- @Manas1820 made their first contribution in #3662
- @l-melon made their first contribution in #3650
- @BenyaminZojaji made their first contribution in #3666
- @paoloemilioserra made their first contribution in #3659
Full Changelog: v0.5.7...reflex-0.5.8
v0.5.7
New Features
- Catch unhandled errors on both frontend and backend by @maximvlah in #3572
rx.App
now supportsfrontend_exception_handler
andbackend_exception_handler
which are called when unhandled exceptions occur.- Fix the error boundary by @maximvlah in #3637
- Bare SQLAlchemy mutation tracking by @benedikt-bartscher in #3628
- feat: Adding an event to go back just as the user would. by @abulvenz in #3636
return rx.event.back()
Improvements
- Recharts Improvements
- minor chart clean up by @Alek99 in #3551
- update graphing by @tgberkeley in #3606
- Tom/recharts missing props by @tgberkeley in #3645
- add warning when using css props on recharts by @Lendemor in #3651
- Make domain props work for
y_axis
by @Lendemor in #3652
- dedupe config overrides by @benedikt-bartscher in #3600
- gitignore external assets by default by @benedikt-bartscher in #3621
- only write .gitignore if needed by @benedikt-bartscher in #3618
- [REF-3160] fix rx.Var._replace raise TypeError on invalid kwargs by @Jishnu-Nandhiath in #3625
- add module prefix to generated state names by @benedikt-bartscher in #3214
- Allow DebounceInput as child of FormControl Component by @ElijahAhianyo in #3660
Bug Fixes
- fix sqla python_type issues, add tests by @benedikt-bartscher in #3613
- Fix 404 on dynamic routes during hot reload
- Avoid model metaclass error with pydantic < 1.10.15
- Fix warnings
- fix unclosed file by @benedikt-bartscher in #3639
- migrate deprecated connections to net_connections by @benedikt-bartscher in #3641
- Pkg resources deprecation by @benedikt-bartscher in #3646
- fix Var.contains pyi by @benedikt-bartscher in #3663
Documentation
- [Graphing Docs] small update by @tgberkeley in #3612
Var Refactor
This release includes some new experimental features being developed incrementally in reflex._x.vars.
- add immutable var class by @adhami3310 in #3607
- [REF-3225] implement format for immutable vars by @adhami3310 in #3617
Other Changes
- pyproject.toml: bump to 0.5.6 by @masenf in #3635
- benchmarks.yml: use node 18.x with reflex-web@main by @masenf in #3657
New Contributors
- @maximvlah made their first contribution in #3572
Full Changelog: v0.5.6...v0.5.7