v0.2.7
版本发布时间: 2023-09-08 07:16:17
reflex-dev/reflex最新发布版本:v0.3.3(2023-11-16 03:29:40)
🙏 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.
- renamed reserved endpoints of Reflex by @Lendemor in #1542
- Caddyfile: reflex uses
/_event
and/_upload
now by @masenf in #1726
App
kwarg connect_error_component
is removed.
Use overlay_component
instead. (#1379)
New Features
Client-side Storage integrated with State #1629
- Allow
rx.LocalStorage
andrx.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 thelibrary
prop of a wrapped component, instead of having to specify them manually in therxconfig.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 https://github.com/reflex-dev/reflex/pull/1647
- Refactor zipping in
reflex export
by @martinxu9 in https://github.com/reflex-dev/reflex/pull/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 https://github.com/reflex-dev/reflex/pull/1681
- Automatically display a Modal when the backend is unable to connect.
- ConnectionModal and ConnectionBanner cleanup by @masenf in https://github.com/reflex-dev/reflex/pull/1379
- Add contains, reverse operations for Var by @martinxu9 in https://github.com/reflex-dev/reflex/pull/1679
- Add special var for upload: clear_selected_files by @martinxu9 in https://github.com/reflex-dev/reflex/pull/1703
- Support automatic serialization of date, datetime, time, and timedelta Vars in a State class.
- added changes for datetime by @wassafshahzad in https://github.com/reflex-dev/reflex/pull/1745
- Raise TypeError when attempting to incorrectly use a state Var in a
bool
oriter
context.- Var:
__**bool__**
and__**iter__**
always raise a TypeError by @masenf in https://github.com/reflex-dev/reflex/pull/1750
- Var:
- Allow dynamic routes to work with static hosting (github pages, netlify, s3, etc)
- Client-side Routing (404 redirect) by @masenf in https://github.com/reflex-dev/reflex/pull/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 https://github.com/reflex-dev/reflex/pull/1652 - Allow event handlers in parent state to be directly called from child state.
- state: _init_event_handlers recursively by @masenf in https://github.com/reflex-dev/reflex/pull/1640
- Allow
rx.form
to work with debounce inputs- [REF-526] debounce_input should respect child ref by @masenf in https://github.com/reflex-dev/reflex/pull/1717
- Track var dependencies in comprehensions and nested functions by @masenf in https://github.com/reflex-dev/reflex/pull/1728
- Proper serialization for chained Event payloads by @masenf in https://github.com/reflex-dev/reflex/pull/1725
Minor Changes and Fixups
- Upgrade to v0.2.6 by @picklelo in https://github.com/reflex-dev/reflex/pull/1669
- Revert "Use DebounceInput wrapper for fully controlled Editable" by @martinxu9 in https://github.com/reflex-dev/reflex/pull/1670
- Use stream_logs for frontend process by @picklelo in https://github.com/reflex-dev/reflex/pull/1682
- Fix run frontend only by @picklelo in https://github.com/reflex-dev/reflex/pull/1706
- Update zh_cn README.md by @sszzz830 in https://github.com/reflex-dev/reflex/pull/1685
- fix: correct the zh_cn README by @milochen0418 in https://github.com/reflex-dev/reflex/pull/1716
- Fix setting substate client storage by @picklelo in https://github.com/reflex-dev/reflex/pull/1723
- Avoid compile step when running production backend by @masenf in https://github.com/reflex-dev/reflex/pull/1665
- AppHarness: disable telemetry for test apps by @masenf in https://github.com/reflex-dev/reflex/pull/1733
- state: _init_mutable_fields for backend vars as well by @masenf in https://github.com/reflex-dev/reflex/pull/1729
- Fix project hash and modernize type annotations by @picklelo in https://github.com/reflex-dev/reflex/pull/1704
- Refactor: Move format_prop Static Method for Improved Reusability by @ElijahAhianyo in https://github.com/reflex-dev/reflex/pull/1714
- ConnectionModal uses Cond for rendering by @masenf in https://github.com/reflex-dev/reflex/pull/1739
- remove some packages requirements in frontend_packages option by @Lendemor in https://github.com/reflex-dev/reflex/pull/1700
- App: only render default overlay_component when DefaultState is not used by @masenf in https://github.com/reflex-dev/reflex/pull/1744
New Contributors
- @shashank40 made their first contribution in https://github.com/reflex-dev/reflex/pull/1681
- @sszzz830 made their first contribution in https://github.com/reflex-dev/reflex/pull/1685
- @nevdelap made their first contribution in https://github.com/reflex-dev/reflex/pull/1724
Full Changelog: https://github.com/reflex-dev/reflex/compare/v0.2.6...v0.2.7