Skip to content

v0.3.0

Compare
Choose a tag to compare
@masenf masenf released this 27 Oct 21:43
· 1265 commits to main since this release
5e444a7

Breaking Changes

Drop Python 3.7 Support

Victory charts are completely removed in this release.

Graph and chart functionailty has been replaced by Recharts, see the docs for more examples.

Removal of Deprecated Browser Storage API

rx.Var Fields are Renamed

Most users are not interacting the Var class directly, but if you are, the following fields have been renamed:

  • name -> _var_name
  • type_ -> _var_type
  • state -> _var_state
  • is_local -> _var_is_local
  • is_string -> _var_is_string

This allows rx.Base and rx.Model classes using these field names to be accessed through State vars.

Prop Values are Validated

Each component prop now defines values as typing.Literal, which has two effects:

  • In IDEs, the allowed values for a field will be prominently displayed.
  • When compiling, invalid literal values for props will raise an exception.

The following code will now raise ValueError

rx.button("Foo", color_scheme="silly")
ValueError: prop value for color_scheme of the `Button` component should be one of the following: none,gray,red,orange,yellow,green,teal,blue,cyan,purple,pink,whiteAlpha,blackAlpha,linkedin,facebook,messenger,whatsapp,twitter,telegram. Got 'silly' instead

If you need to pass an unrecognized prop value, you can wrap it in an rx.Var.

rx.button("Foo", color_scheme=rx.Var.create("silly"))

New Features

New Base Template

When running reflex init in a new directory, a multi-page template will be deployed instead of the Welcome to Reflex page. This provides a better starting point for more complex apps.

Use reflex init --template blank to generate a new app with the previous template.

New Component: rx.data_editor

Based on the Glide Data Grid, the new rx.data_editor component supports in place editing of data tables and is more feature rich than the existing rx.data_table component.

See the docs for more examples and details.

(Note: pandas dataframe is not currently supported, but will be coming soon)

State.router

The State.router property provides access to the current page's router data in a way that can be accessed from both the frontend and the backend.

Previous State.get_current_page(), State.get_query_params(), and others are now deprecated.

  • deprecate get_ methods for router_data, use BaseVars instead by @Lendemor in #1967

New component: rx.moment

Simple date/time formatting on the frontend, and provides an event trigger that can be fired peridically from the frontend.

Reflex Hosting Preview

This release includes support for the new Reflex Hosting service, currently in closed testing, please reach out on Discord for more information.

Demo App

Running reflex demo will now open a demo app based on the new base template showing some reflex features.

(Currently using a remotely hosted version of the app, but subsequent release will run the demo app locally.)

Radix Themes Preview

Reflex is moving away from Chakra-UI component to Radix-UI. And some of the new components are available in this release for testing in the reflex.components.radix.themes module. More details to follow.

  • [REF-668] Wrap MyApp with radix Theme component by @masenf in #1867
  • [REF-938] Fix up radix themes issues by @masenf in #2002

Improvements

Automatic API_URL

Most users will not have to explicitly set API_URL unless their frontend and backend are running on different hosts or via a load balancer.

When the default API_URL of http://localhost:{backend_port} is used, and the frontend is not being accessed on localhost, assume that the backend and frontend are on the same host.

  • [REF-843] Automatically update api_url and deploy_url by @masenf in #1954

Support for Static Sites

Do not display the connection error banner or attempt to connect to the backend if the app does not use State.

Improve reflex export

  • Support exporting to zip archives to a dir that is not cwd (to be use by hosting cli) by @jackie-pc in #2005
  • [reflex export] backend.zip excludes dirs that look like venv dirs by @jackie-pc in #2009

Access Relationship Attributes on rx.Model

  • Improve Var type handling for better rx.Model attribute access by @masenf in #2010

Autogenerate missing requirements.txt

An app must have a requirements.txt to be deployed via the hosting service, so Reflex will create one based on top-level packages in the environment where it is running.

  • Autogenerating Dependencies During Deployment by @Alek99 in #2033

Support callback in rx.call_script

When running arbitrary script, it is now possible to pass the result back to an Event Handler. See the updated docs for more examples.

Miscellaneous

Bug Fixes

  • Fix custom components special props by @picklelo in #1956
  • Fix charts not displaying without specifying width and height
    • ChartBase.create: include default min dimensions (RESUB) by @masenf in #1975
  • Fix Cookie and LocalStorage values being reset on navigation
  • Bug: changing type of playing by @Billa05 in #1986
  • Rehydrate client storage after rx.remove_local_storage and rx.remove_cookies by @ElijahAhianyo in #1998
  • multi_select somewhat usable by @masenf in #1861
  • fix fnm version check by @Lendemor in #2014
  • Resolve npm path and fnm path on Windows by @masenf in #2015
  • Radix Themes style notation fix by @ElijahAhianyo in #2025
  • Generate state delta from processed state instance by @masenf in #2023
  • fix onload method not working in prod mode (and hosting) by @Lendemor in #2049
  • Add none to color scheme literal by @ElijahAhianyo in #2055

README translations

Other Changes

New Contributors

Full Changelog: v0.2.9...v0.3.0