github reflex-dev/reflex v0.2.7

latest releases: v0.7.6, v0.7.5, v0.7.4...
19 months ago

🙏 Thanks to our supportive community and helpful contributors! 💪

Breaking Changes

Default Websocket Endpoint is now /_event #1542

Upload endpoint also moved to /_upload.

Any reverse proxy configurations that were explicitly forwarding /event and /upload to the backend server should be updated to use the new endpoints.

App kwarg connect_error_component is removed.

Use overlay_component instead. (#1379)

New Features

Client-side Storage integrated with State #1629

  • Allow rx.LocalStorage and rx.Cookie type vars in a State class that are automatically persisted in the client browser when modified on the backend.
  • These values can be used in frontend or backend code just like any other state Var.
class State(rx.State):
	my_token: rx.LocalStorage = ""
  my_hour_cookie: rx.Cookie = rx.Cookie("initial", max_age=3600)

  def set_token(self):
    self.my_token = str(uuid.uuid4())

  def update_cookie(self):
    if self.my_hour_cookie == "initial":
      self.my_hour_cookie = "updated"

Implement on_mount and on_unmount for all components #1636

These new event handlers, present on all components, tie into React’s useEffect hook and are used to trigger backend events needed to initialize a component when it loaded in a page.

Note: on_mount will fire twice in dev mode due to the use of React’s StrictMode.

Note: on_mount will not fire for page navigation events between different params of the same dynamic route, since the page itself does not get reloaded so no remount occurs. For navigation events, see on_load argument of app.add_page.

FNM is now used to install nodejs on POSIX platforms

by @ElijahAhianyo in #1606 #1701

frontend_packages are automatically determined #1607

  • frontend_packages are inferred based on the library prop of a wrapped component, instead of having to specify them manually in the rxconfig.py file.
  • The library prop may now include a version pin, like **library =** "gridjs-react@^6.0.1"
  • The package.json list of frontend dependencies only includes components that are actually used in the app, which decreases bundle size.
  • To include additional dependencies used by a component, specify them in the new lib_dependencies prop of the wrapped component.

Per-component prop autocompletion for IDEs #1708

Generated .pyi files provide better function signatures for component create methods, enumerating most recognized props.

Further enhancements will be supplied in a future release to include per-prop documentation and improved signatures for event handlers.

Support Breakpoints in VSCode and PyCharm #1653

  • Breakpoints set in the IDE will be respected when running the project in dev mode. See DEBUGGING.md for an example.

Expose basePath configuration option #1724

Support running multiple reflex apps from the same domain by changing the basePath prefix that the frontend uses (by @nevdelap).

Improvements

  • Validate component children by @ElijahAhianyo in #1647
  • Refactor zipping in reflex export by @martinxu9 in #1668
  • Avoid leaking secrets in log files and on the console.
    • fix:issue-1667;added if condition check to not echo DB_URL by @shashank40 in #1681
  • Automatically display a Modal when the backend is unable to connect.
    • ConnectionModal and ConnectionBanner cleanup by @masenf in #1379
  • Add contains, reverse operations for Var by @martinxu9 in #1679
  • Add special var for upload: clear_selected_files by @martinxu9 in #1703
  • Support automatic serialization of date, datetime, time, and timedelta Vars in a State class.
  • Raise TypeError when attempting to incorrectly use a state Var in a bool or iter context.
    • Var: __**bool__** and __**iter__** always raise a TypeError by @masenf in #1750
  • Allow dynamic routes to work with static hosting (github pages, netlify, s3, etc)
    • Client-side Routing (404 redirect) by @masenf in #1695
    • Fix browser error when navigating to missing route and custom 404 page is not used.
    • No need to run the frontend nodejs process, see updated docker-example.

Bug Fixes

  • ReflexList: reassign field on insert by @masenf in #1652
  • Allow event handlers in parent state to be directly called from child state.
    • state: _init_event_handlers recursively by @masenf in #1640
  • Allow rx.form to work with debounce inputs
    • [REF-526] debounce_input should respect child ref by @masenf in #1717
  • Track var dependencies in comprehensions and nested functions by @masenf in #1728
  • Proper serialization for chained Event payloads by @masenf in #1725

Minor Changes and Fixups

New Contributors

Full Changelog: v0.2.6...v0.2.7

Don't miss a new reflex release

NewReleases is sending notifications on new releases.