* rx.upload must include _var_data from props
str-casting the dropzone arguments removed any VarData they depended on, like
the state context.
update test_upload to include passing a prop from a state var
* Handle large payload delta from upload event handler
Fix update chunk chaining logic; try/catch wasn't catching errors from the
async inner function.
* Unit test updates
* test_client_storage: simulate backend state expiry
* [HOS-333] Send a "reload" message to the frontend after state expiry
1. a state instance expires on the backing store
2. frontend attempts to process an event against the expired token and gets a
fresh instance of the state without router_data set
3. backend sends a "reload" message on the websocket containing the event and
immediately stops processing
4. in response to the "reload" message, frontend sends
[hydrate, update client storage, on_load, <previous_event>]
This allows the frontend and backend to re-syncronize on the state of the app
before continuing to process regular events.
If the event in (2) is a special hydrate event, then it is processed normally
by the middleware and the "reload" logic is skipped since this indicates an
initial load or a browser refresh.
* unit tests working with redis
On py3.9 and py3.10, `dict[str, str]` and other typing forms are kinda
considered classes, but they still fail when doing `issubclass`, so
specifically exclude generic aliases before calling issubclass.
Fix#4424
Bonus fix: support upcasting of pydantic v1 and v2 models
* wip rx._x.asset improvements
* only add symlink if it doesn't already exist
* minor improvements, add more tests
* use deprecated Generator for python3.8 support
* improve docstring
* only allow explicit shared, only validate local assets if not backend_only
* fix darglint
* allow setting backend only env to false.
* use new is_backend_only in assets
* ruffing
* Move to `rx.asset`, retain old API in `rx._x.asset`
---------
Co-authored-by: Masen Furer <m_github@0x26.net>
* [ENG-3953] Support pydantic BaseModel (v1 and v2) as state var
Provide serializers and mutable proxy tracking for pydantic models directly.
* conditionally define v2 serializer
Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
* Add `MutableProxy._is_mutable_value` to avoid duplicate logic
* Conditionally import BaseModel to handle older pydantic v1 versions
* pre-commit fu
---------
Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
* Rework Init workflow
* minor format
* refactor
* add comments
* fix pyright alongside some improvements
* add demolink for blank template
* fix darglint
* Add more templates and keep template name in kebab case
* revert getting other templates since we'll use the submodules approach
* remove debug statement
* Improvements based on standup comments
* Add redirect logic
* changes based on new flow
---------
Co-authored-by: Masen Furer <m_github@0x26.net>
When an event/event spec is marked as "temporal", it will not be queued unless
the backend is up. This can be used to prevent periodic events (like from
`rx.moment`) from queueing up while the backend is down, and then stampeding
when the backend comes up and the queue is drained. It can be used to avoid
processing many periodic events at once when the app is only expecting to
process such an event every so often.
* Handle Var passed to `rx.toast`
If the user provides a `Var` for `message` then apply it as `props["title"]` to
avoid a var operations error.
* remove unnecessary parentheses
* remove weird hacks
* get it right pyright
---------
Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
In some cases, a routing failure can cause the failure to be cached. When the
router has a cached failure, pushing such a route will never call
routeChangeComplete, and thus on_load event will never be fired for that route.
Purposely clearing the error from the router allows the page to properly load
on subsequent attempts without refreshing the app.
The `rich` module should be set to `None`, indicating that rich should not be used.
Setting it to `False` worked before, but recently added code in typer fails
when checking `if rich is not None`.
ref: https://github.com/fastapi/typer/pull/847
* add typing to function vars
* import ParamSpec from typing_extensions
* remove ellipsis as they are not supported in 3.9
* try importing everything from extensions
* special case 3.9
* don't use Any from extensions
* get typevar from extensions
Because of some dodgy logic in Base.get_value and State.dict / State.get_delta
when the value of some state var X happened to be the name of another var in
the state Y, then the value for X would be returned as the value of Y.
wat.
Fixes#4369
* Temporarily downpin @radix-ui/themes <3.1.5
A visual/style regression was introduced in @radix-ui/themes 3.1.5
as described in radix-ui/themes#627 which reflex needs to avoid.
* Get expected radix library version from component