Skip to content

Releases: reflex-dev/reflex

v0.4.9

23 Apr 16:57
1e6d31a
Compare
Choose a tag to compare

New Features

Improvements

Bug Fixes

  • [REF-2586] Pass child event_trigger through DebounceInput by @masenf in #3092
    • on_key_down / on_key_up work with controlled inputs
  • [REF-2589] Use errors='replace' with subprocess by @masenf in #3096
    • Avoid UnicodeDecodeError on windows
  • [REF-2587] Ignore top-level theme appearance (#3119)

Experimental

Other Changes

Full Changelog: v0.4.8...v0.4.9

v0.4.8.post1

20 Apr 04:02
75fee92
Compare
Choose a tag to compare

Pin react-focus-lock to 2.11.13 #3123

v0.4.8

15 Apr 22:15
64805d3
Compare
Choose a tag to compare

New Features

new transpile_packages field in rx.Component

For packages on npm which are not exported as modules, these can now be transpiled by Next.JS and used directly.

  • [REF-2392] Expose next.config.js transpilePackages key by @masenf in #3006

Improvements

Use bun as a package manager on windows

Much faster package installation on windows!

x64 only (no x86 or ARM support)

  • [REF-1586] Use bun as a package manager on windows by @masenf in #2359

Upload with no files selected still calls event handler

Note: you need to specify a default value for your files parameter to take advantage of this change.

  • Fix For When user selects Empty files using File Upload by @Yummy-Yums in #3051

Enum types are now serialized to their value

Automatic tuple unpacking also works for Component children

Bug Fixes

Experimental

Other Changes

New Contributors

Full Changelog: v0.4.7...v0.4.8

v0.4.7

09 Apr 22:10
bf28dab
Compare
Choose a tag to compare

New Features

New reflex init templates

We've added 4 new base templates to reflex init.

(0) blank (https://blank-template.reflex.run) - A minimal template
(1) dashboard (https://dashboard.reflex.run) - A dashboard with tables and graphs
(2) chat (https://chat.reflex.run) - A ChatGPT clone
(3) sidebar (https://sidebar-template.reflex.run) - A template with a sidebar to navigate pages

You can also specify the template directly

reflex init --template chat

Use any Reflex app on Github as an initial template

reflex init now also supports passing in any Github url as a template. Currently the Reflex app must be in the root of the Github directory (meaning the rxconfig.py should be in the root.

reflex init --template https://github.com/reflex-dev/reflex-chat
  • Support reflex app creation from templates from github by @martinxu9 in #2490

reflex run will automatically init the app when required

Previously when updating versions of Reflex or cloning an existing Reflex app, you would have to run reflex init before you can reflex run. From 0.4.7, reflex init is only required the very first time you create an app. If you are missing a .web folder or there's a new version of Reflex, reflex run and reflex export will automatically init the app for you.

rx.logo() component to display the Reflex logo

Show Built with Reflex logo.

rx.logo()

Reflex Experimental Namespace

We've introduced a new rx._x namespace where we will be putting experimental features for early testers before they go into general release. This will help us make sure new features have time to mature with real users before we make them public

Improvements

None can be passed in as a component prop and it will be skipped

  • Logic for removing the 'None' property along with its corresponding test cases by @AmanSal1 in #2969

Leaving a trailing comma on a reflex component won't throw an error anymore as we unpack the tuple

Bug Fixes

Misc

New Contributors

Full Changelog: v0.4.6...v0.4.7

v0.4.6

01 Apr 23:49
5c8d5e5
Compare
Choose a tag to compare

Known Issues

  • Unhandled runtime error when navigating between pages in a stateless app.

This Release was Airdropped from 30000' over Nevada ๐Ÿช‚

IMG_2840

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 #2922

New Features

reflex component share CLI

Simplify sharing of custom 3rd party components to the Reflex Component Gallery.

  • [REF-2168] Add share options to custom component commands by @martinxu9 in #2883

rx.ComponentState

An easy way to define per-component State.

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 #2923

Automatically Select Next Available Port

When the configured port is not available, automatically select the next sequential port until one is available

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 #2884

rx.scroll_to event

Scroll the viewpoint to show a given element by ID.

Improvements

Simplify Component Wrapping API

[REF-2272] Support declaring EventHandlers directly in component by @martinxu9 in #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 #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.

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).

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 #2949

Miscellaneous

  • [REF-1982] state: Warn if redis state is "too big" by @masenf in #2868
  • use radix box instead of chakra one for responsive elements by @Lendemor in #2921
  • [REF-2229]Dedupe deprecation warnings by @ElijahAhianyo in #2871
  • fix hook order to use ref inside user hooks by @Lendemor in #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 #2893

Bug Fixes

  • [REF-2117]:rx.color_mode_cond to work in f-strings by @ElijahAhianyo in #2775
  • Default to None if bun/fnm version is Invalid by @ElijahAhianyo in #2940
  • remove inheritance from Flex for list components by @Lendemor in #2936
    • Fix markdown rendering of lists
  • parse_args_spec: resolve annotations with typing.get_type_hints by @masenf in #2849
  • [REF-2219] Avoid refetching states that are already cached by @masenf in #2953
    • Fix issue affecting Cookie/LocalStorage values when substates contained computed vars
  • [REF-2306] Include twine in dependencies on pyproject.toml by @martinxu9 in #2895

Other Changes

New Contributors

Full Changelog: v0.4.5...v0.4.6

v0.4.5

20 Mar 20:04
ab7b856
Compare
Choose a tag to compare

New Features

Support SQLAlchemy Models Directly

Experimental Multi-process Compilation

Pass REFLEX_COMPILE_PROCESSES=0 to opt-in to multiprocess compile, which significantly improves compilation speed of large apps (Mac and Linux only).

  • [REF-2122] Opt-in multiprocess compile by @masenf in #2838

Improvements

Bug Fixes

  • [REF-2172] Add DECORATED_PAGES before compiling in thread by @masenf in #2841
    • Fix known regression with py3.8 and py3.9
  • Remove width prop from rx.select by @picklelo in #2835
    • HighLevelSelect: pass flex_shrink prop to SelectTrigger by @masenf in #2876
  • Get client_ip from asgi.scope by @masenf in #2808
    • router.session.client_ip more likely to be correct now
  • convert text inside list_item to span and set icon display to inline by @Lendemor in #2860

Other Changes

  • [REF-2086] Avoid "Warning: The path to the Node binary could not be found. by @masenf in #2803
  • telemetry refactor + unit tests by @Lendemor in #2786
    • When __REFLEX_SKIP_COMPILE == "yes" allow telemetry to fail by @masenf in #2881
  • Custom Component Request Template by @Alek99 in #2853
  • Benchmark with app harness by @ElijahAhianyo in #2774
  • Fix py3.8 integration test_var_operations.py by @masenf in #2858
  • Account for imports of @rx.memo components for frontend package installation by @masenf in #2863
  • [REF-2216] Warn if windows is used with py312 by @masenf in #2856
  • Separate get_hooks and get_hooks_internal for stable output by @masenf in #2710
  • [REF-2219] vars: set _was_touched when updating cached vars by @masenf in #2886

New Contributors

Full Changelog: v0.4.4...v0.4.5

v0.4.4

11 Mar 22:53
b219540
Compare
Choose a tag to compare

Known Issues

py3.8 and py3.9 using @rx.page with REDIS_URL set:

RuntimeError: There is no current event loop in thread 'ThreadPoolExecutor-0_0'.

Breaking Changes

Component._get_vars signature change

Unlikely to affect most users; however the signature of Component._get_vars has changed to accept a new include_children parameter which should either be handled internally or passed to super()._get_vars if this function has been overridden in a custom component.

New signature

def _get_vars(self, include_children: bool = False) -> Iterator[Var]:

New Features

Expose lang and other attributes on <html> tag

rx.upload exposes on_drop event trigger

Trigger upload immediately after files are selected by passing an rx.upload_files-wrapped handler directly to on_drop trigger.

  • Expose on_drop event trigger for rx.upload component. by @masenf in #2766

rx.el.form supports on_submit event trigger

  • [REF-1368] Move common form functionality to rx.el.forms by @masenf in #2801

Improvements

Dependency Changes

Enable /_upload when get_upload_url is used

Previously, the rx.upload component was the only thing that resulted in the endpoint being enabled.

  • Mark Upload.is_used when calling get_upload_url by @masenf in #2765

Update docker-example for more realistic deployments

  • a simple dual port Dockerfile

  • compose.yaml providing a separate backend container and static frontend served with automatic TLS

    • Support volumes for data and uploaded files
  • compose.prod.yaml including postgres database and redis containers

  • app.Dockerfile for single container, single port deployment on a platform service like Render, Railway, and Google Cloud Run

  • docker-example overhaul by @masenf in #2690

  • Include app.Dockerfile for deploying to container hosting platform by @masenf in #2784

Improve "Stateless" app detection

Apps which import State, but do not actually use it are considered stateless.

Apps that use rx.State.router automatically work without defining a dummy substate.

Apps dynamically create state at runtime (#1877) correctly include used dynamic substates.

Better support for plain SQLAlchemy

reflex component CLI improvements

  • Build and publish in a single step

  • Improved custom component template

  • More comprehensive .gitignore

  • fix template for custom comp by @Lendemor in #2787

  • [REF-2141] Custom component command improvements by @martinxu9 in #2807

EventChain list syntax is undeprecated

It is now acceptable to pass a list of multiple EventHandler to an event trigger, such as on_click.

Bug Fixes

  • Fix Padding in Accordion component
  • Skip node install if version requirements are met
  • Fix infinite recursion when a substate named "state" has a computed var by @masenf in #2778
  • Fix /_upload 404 and missing on_load handlers in production deployment
    • app_module_for_backend: wait for _compile in prod mode by @masenf in #2760
  • [REF-2087] Better rx.progress styling integration with radix themes by @masenf in #2762
  • Updating initialize_gitignore() to avoid modifying the encoding of the .gitignore file by @cllatser in #2797
  • Fix tab freezing and crash when appearance="dark" and theme_panel=True
    • [REF-1994] ThemePanel: clear chakra-ui-color-mode key when using theme panel by @masenf in #2799
  • [REF-2098] Allow overlay Close components to have on_click handlers by @masenf in #2793

Other Changes

New Contributors

Full Changelog: v0.4.3...v0.4.4

v0.4.3

04 Mar 22:52
c314d7f
Compare
Choose a tag to compare

New Features

Set initial_value for rx.var and rx.cached_var

Provide a placeholder to avoid evaluating computed vars during compile time, for example, if they would perform database queries or other expensive operations.

class MyState(rx.State):
    @rx.var(initial_value=42)
    def answer(self):
        with rx.session() as session:
            session.exec(...)

State.get_state allows access to arbitrary substates from within an event handler

class MyState(rx.State):
    answer: int = 42

class OtherState(rx.State):
    async def get_answer(self):
        my_state = await self.get_state(MyState)
        print(f"The answer is {my_state}.answer")

Note that get_state is an async function and must be await'ed

  • [REF-1988] API to Get instance of Arbitrary State class by @masenf in #2678

CLI for Creating and Publishing 3rd Party Components

Improvements

Allow accent as a valid choice in rx.color

Chakra no longer used when rendering Markdown

Sidebar template uses all Radix components

Disallow invalid /api prefix for frontend page routes

These routes conflict with what NextJS considers special "API routes" and thus do not work for reflex pages.

  • [REF-1741] Disallow routes with /api prefix by @masenf in #2711

rx.plotly now accepts arbitrary config prop

Computed Backend-only Vars

Connection Pulser While Websocket is Disconnected

Only show the "Connection Error" banner after a few failed reconnection attempts.

  • add pulser for connection + adjust condition for connnection_modal by @Lendemor in #2676

Reconnect Websocket in Stale Tabs

When a browser tab regains focus, automatically reconnect the websocket if it is disconnected.

Bug Fixes

Other Changes

New Contributors

Full Changelog: v0.4.2...v0.4.3

v0.4.2

26 Feb 20:05
b13a25c
Compare
Choose a tag to compare

New Features

Syncronize LocalStorage between tabs

Pass the new sync=True argument to rx.LocalStorage to enable changes on one tab to automatically update in other tabs.

  • feat: Synchronizing localStorage between tabs using browser events by @abulvenz in #2533

Improvements

Tuple type annotations are now respected index-wise

Substates are serialized individually

This allows apps with large state to only serialize and deserialize the parts of the state needed to handle a given event.

  • [REF-1885] Shard Substates when serializing to Redis by @masenf in #2574

Better Image Serialization

Improves mime type detection for more types of PIL Image objects.

Other Improvements

Bug Fixes

  • Fix SQLAlchemy list types by @benedikt-bartscher in #2668
  • [REF-2045] Implement reduce_ex for MutableProxy by @masenf in #2688
  • Fix for setting rx.theme(appearance="dark") (Note: dark mode does not work with rx.theme_panel)
    • Apply app theme color_mode/appearance as next-themes default by @masenf in #2654
  • rx.Upload can now contain children components that use State.

Accordion Issues

  • Fix Browser Warnings
  • Fix accordion not working with rx.foreach

Other Changes

New Contributors

v0.4.1

20 Feb 02:49
6384c62
Compare
Choose a tag to compare

Fix Windows Hot-reload

Improvements

Avoid Browser Error When Uploading

  • fix: File upload error after using rx.clear_selected_files by @abulvenz in #2666

Bug Fixes

  • [REF-1993] link: respect is_external prop and other attributes on A tag by @masenf in #2651

New Contributors

Full Changelog: v0.4.0...v0.4.1