Skip to content

Releases: reflex-dev/reflex

v0.8.17

27 Oct 17:49

Choose a tag to compare

Release Notes

Pass event name for lock expiry messages

Expose Sourcemap generation via VITE_SOURCEMAP, and rolldown experimental HMR via VITE_EXPERIMENTAL_HMR

Misc

Bugfixes

  • ENG-8034: fix window events inside of memoization leaf by @adhami3310 in #5899
  • fix: properly initialize rx.Field annotated backend vars in mixin states by @benedikt-bartscher in #5909
  • ENG-8113: handle_frontend_exception triggers auto reload by @masenf in #5922
  • ENG-8050: background event updates set final=None by @masenf in #5898

Chores

New Contributors

Full Changelog: v0.8.16...v0.8.17

v0.8.16

21 Oct 03:34

Choose a tag to compare

Release Notes

StateManagerDisk with throttled write

To improve performance on IO-bound devices, disk manager only commits its memory every two seconds or so. Configurable through the environment variable: REFLEX_STATE_MANAGER_DISK_DEBOUNCE_SECONDS

  • ENG-7948: StateManagerDisk deferred write queue by @masenf in #5883

Dialog Trigger must be child of Dialog Root

In technicality, dialog trigger can be anywhere in the nested children of a dialog root. However, this is a useful proxy for now.

Chores

Full Changelog: v0.8.15...v0.8.16

v0.8.15

15 Oct 02:36

Choose a tag to compare

Release Notes

Deprecations

rx.Base is deprecated.

Now that pydantic is an optional dependency, Reflex will no longer maintain a custom wrapper over BaseModel. You have a few options for replacing your rx.Base subclasses:

  • Continue to use pydantic -- minimal code/behavior changes
    • Ensure pydantic is part of your app dependency list
    • Extend from pydantic.BaseModel instead of rx.Base
  • Move to dataclasses.dataclass -- use the python stdlib
  • Move to typing.TypedDict -- uses a plain dict, but has extra type hints to make Var Operations work correctly

sqlmodel.SQLModel is now recommended over rx.Model.

  • Change your db models to inherit from sqlmodel.SQLModel instead of rx.Model.
  • Ensure the model has an explicit primary_key column. The default previously used to be:
    • id: int | None = sqlmodel.Field(default=None, primary_key=True)
  • Use sqlmodel.select(MyModel) instead of MyModel.select().

Python 3.14 is now supported! Python 3.10 deprecated D:

Python 3.14 got release on 10/07 and now Reflex supports it! It gives us very considerable performance improvements just by bumping.

In theory, you can use reflex with python free threaded, although we don't officially support it just yet. If you do run into issues with it, do report it!

Make pydantic, sqlmodel, and alembic optional

We will still install them by default until 0.9. You can ease into the transition by setting your reflex dependency to reflex[db]. You can uninstall them and reflex will continue to work assuming you don't use those in your app.

Upcast enum values to their enum type on event handlers

  • Upcast str or int to annotated Enum type in event handlers by @masenf in #5855

Performance Improvements

Bugfixes

  • make on load lambda work by @adhami3310 in #5856
  • Apply attribute access rules for Model or SQLModel by @masenf in #5875
  • Munge router_data["pathname"] consistently in event processing path by @masenf in #5873
  • ENG-7948: Fix hanging frontend and other reconnection woes by @masenf in #5884
  • check domain before redirecting in codespaces by @adhami3310 in #5886

Chores

Full Changelog: v0.8.14...v0.8.15

v0.8.14

06 Oct 20:39

Choose a tag to compare

Release Notes

Revert ColorVar having .color .alpha .shade

ColorVar being a non primitive string (new String) has proven more problematic than it is useful.

Add --single-port option to reflex run --env prod

Since the app is compiled, there is no need for using a node server to run the frontend and have two ports. You can simply use reflex run --env prod --single-port to host the frontend and backend on the same port.

It's still recommended to serve your frontend on a CDN if possible. Although if you're going for really simple deployments, one port will suffice!

Treat on_drop=State.handle_upload, as on_drop=State.handle_upload(rx.upload_files(upload_id))

the following:

rx.upload(
    id="upload",
    on_drop =State.on_upload,
)

would be converted to

rx.upload(
    id="upload",
    on_drop =State.on_upload(rx.upload_files("upload")),
)

Add primitive radix dialog

It's unstyled, but it makes it easier to use with tailwind and such if you aren't interested in radix themes.

def dialog():
    return rx.radix.primitives.dialog.root(
        rx.radix.primitives.dialog.trigger(...),
        rx.radix.primitives.dialog.portal(
            rx.radix.primitives.dialog.overlay(...),
            rx.radix.primitives.dialog.content(
                rx.radix.primitives.dialog.title(...),
                rx.radix.primitives.dialog.description(...),
                ...,
                rx.radix.primitives.dialog.close(...)
            )
        )
    )

The interface looks almost identical to rx.dialog.

Bugfixes

Chores

Full Changelog: v0.8.13...v0.8.14

v0.8.13

29 Sep 18:54

Choose a tag to compare

Release Notes

Rework ColorVar to support its subfields

class State(rx.State):
    theme: rx.Color = rx.color("red", 2)

# All of those are valid:
State.theme
State.theme.color
State.theme.shade
State.theme.alpha
  • rework transformers and serialize subfields of color vars by @adhami3310 in #5819

Upgrade react-player (rx.video) to v3

There are some providers that got removed in the update and the API changed. We added a mapping to maintain them as close as possible. If you get any deprecation warnings related to rx.video that's why.

Automatically convert time and date from str if event handler function is typed as such

If you have an event handler:

import datetime
class State(rx.State):
    @event
    def receive_datetime(self, t: datetime.datetime):
        ...

Then you can do:

State.receive_datetime(datetime.datetime.now())

That used to fail, since we go to the frontend and back, which would serialize the datetime into a string to be stored in JSON. Now we attempt to convert the str into the typed parameter if possible for datetime objects.

Add option to disable server-side rendering for reflex export and reflex deploy

You can pass --no-ssr to the commands to disable react router per-rendering routes. Note that might hurt your SEO performance. You can also configure that with REFLEX_SSR=1/0.

Bugfixes

Chores

Full Changelog: v0.8.12...v0.8.13

v0.8.12

22 Sep 23:02

Choose a tag to compare

Release Notes

Add on_drop_rejected to handle file type failures

  • ENG-7732: plumb through Upload.on_drop_rejected by @masenf in #5806

Include assets folder in backend.zip by default, and add --exclude-from-backend CLI option

Improved websocket reliability in disconnection cases

  • Reassociate sid and token when connecting websocket by @masenf in #5794
  • Remove token/sid associations when server is exiting by @masenf in #5802
  • Automatic websocket reconnect and reload handling by @masenf in #5805

.db files are now ignored from hot-reload watchfiles by default

Bugfixes

Check against using components as styles accidentally

If you do:

rx.el.div(something=rx.icon(...))

The icon would be interpreted as style value. That used to raise a runtime error, now it happens at compile time.

console.error now correctly point to stderr

Previously things like backend exceptions and frontend exceptions wouldn't go to stderr. This is now fixed.

Doing foreach over a null that is mistakenly typed as a list or an object will not result in a runtime error (would be just an empty list)

Env vars properly update from REFLEX_ENV_FILE with Granian

Misc

Performance Improvements

Chores

New Contributors

Full Changelog: v0.8.11...v0.8.12

v0.8.11

15 Sep 17:59

Choose a tag to compare

Release Notes

Support EventHandler in rx.PropsBase

  • PropsBase converts EventHandler-annotated props to EventChain by @masenf in #5765

Bugfixes

Chores

Full Changelog: v0.8.10...v0.8.11

v0.8.10

10 Sep 00:22
a605e7a

Choose a tag to compare

Release Notes

rx.redirect now takes popup option.

WARNING: This also made it such that is_external and replace are keyword-only arguments.

You can use popup along with is_external to make a popup screen. Be wary that some browsers might block those (occasionally).

Pass along SQL Alchemy Pool configuration

You can use the environment variables: SQLALCHEMY_POOL_SIZE, SQLALCHEMY_MAX_OVERFLOW, SQLALCHEMY_POOL_RECYCLE, and SQLALCHEMY_POOL_TIMEOUT to configure their corresponding pool configuration.

Determinism Fixes

The Reflex compiler should ideally be deterministic. We fixed a few spots where it wasn't. This included switching from sets to dicts in a few places and fixing the seed for the random ID for components. This should ideally limit the number of unintended HMR errors.

Styles Fixes

With --env prod, some CSS styles might appear in the wrong order, causing weird styling. This is now fixed.

  • put reflexGlobalStyles before everything and add style to radix theme root by @adhami3310 in #5763

Re-add UploadFile.filename to maintain compatibility with Starlette

We removed that property because it had inconsistent value among browsers. Now it's back, but it should be consistent.

  • readd UploadFile.filename for compat with StarletteUploadFile by @adhami3310 in #5772

Specify extra_headers to rx.upload_files

In case you want your upload files post request to have extra headers, you can use the extra_headers keyword argument.

Chores

Full Changelog: v0.8.9...v0.8.10

v0.8.9

02 Sep 20:34

Choose a tag to compare

Release Notes

Deprecate state_auto_setters being defaulted to True.

In 0.9.0 this option will default to False. Set it to True if you want to use set_ pattern, or implement setters explicitly.

Option to disable Vite's Hot-Module-Reload

In case you are getting "No module update found for route", you can force full page reload on updates by setting the environment variable VITE_FORCE_FULL_RELOAD to 1. In case you want to disable the reload completely (so refreshing manually to update the page), you can set VITE_HMR to 0.

ImportVar(tag="*", is_default=True, alias='Alias) works as expected now

It renders to:

import * as Alias from '...'

Wrap additional SVG elements.

Those include: Polyline, SvgImage, Use, TSpan, TextPath, Pattern, ClipPath, Symbol, Mask, ForeignObject, SvgA, Animate, AnimateMotion, AnimateTransform, Set, MPath, Desc, Title, Metadata, Script, SvgStyle, Switch, View

Performance optimizations

Some cleanups in particularly offending functions. It doesn't affect most things but it does improve things by a bit.

Serialize Memo components as Vars

You can use memo components as Vars of type=type[Component].

Chores

Full Changelog: v0.8.8...v0.8.9

v0.8.8

25 Aug 22:11

Choose a tag to compare

Release Notes

Performance Optimizations

We replaced jinja2 with simpler fstring calls. This resulted in approximately 30% faster rendering step. We also optimized the import collections by ~15%.

Add more information to asyncio Tasks

If a task gets cancelled or such now Reflex will add a bit more information to what task that was.

  • Provide descriptive names for asyncio.Task by @masenf in #5727

Bugfixes

Chores

Full Changelog: v0.8.7...v0.8.8