* Avoid fetching substates multiple times
In the presence of computed vars, substates may be cached more than once.
* Consolidate logic in StateManagerRedis.get_state
* Suppress StateSchemaMismatchError and create a new state instance.
If the serialized state's schema does not match the current corresponding state
schema, then we have to create a new instance.
* add workflow to check dependencies on release branch
* rename action to follow convention of other actions
* update workflow
* bump poetry version
* relock deps
* update check to ignore pyright and ruff
* oops, you saw nothing
* split dep check in two job
* fix frontend dep check
* fix stuff
* hmm yeah
* nope nope nope
* sigh
* bump js versions for some packages
* fix some warnings in tests
* fix tests
* try some options
* try to set asyncio policy
* debug dep check
* fix attempt for backend dep
* clean up output for backend check
* run bun outdated on reflex-web to catch most of the packages
* fix python version
* fix python version
* add missing env
* fix bun command
* fix workdir of frontend check
* update packages version
* up-pin plotly.js version
* add debug ouput
* clean frontend dep check output
* fix output
* fix async tests for redis
* relock poetry.lock
* Non-async functions do not need pytest_asyncio.fixture
* test_state: close StateManagerRedis connection in test to avoid warning
---------
Co-authored-by: Masen Furer <m_github@0x26.net>
* Only serialize base vars
* Never serialize router/router_data in substates
* Hash the schema to reduce serialized size
* lru_cache the schema to avoid recomputing it
* Get default for backend var defined in mixin
If the backend var is defined in a mixin class, it won't appear in
`cls.__dict__`, but the value is still retrievable via `getattr` on `cls`.
Prefer to use the actual defined default before using
`Var.get_default_value()`.
If `Var.get_default_value()` fails, set the default to `None` such that the
backend var still gets recognized as a backend var when it is used on `self`.
----
Update test_component_state to include backend vars
Extra coverage for backend vars with and without defaults, defined in a
ComponentState/mixin class.
* fix integration test
* Simplify StateManagerDisk implementation
* Act more like the memory state manager and only track the root state in self.states
* .load_state always loads a single state or returns None
* .populate_states is the new entry point in loading from disk and it only occurs
when the root state is not known
* much fast
* StateManagerDisk now acts much more like StateManagerMemory
Treat StateManagerDisk like StateManagerMemory for AppHarness
* Handle root_state deserialized from disk
In this case, we need to initialize the whole state tree, so any non-persistent
states will still get default values, whereas on-disk states will overwrite the
defaults.
* Cache root_state under client_token for StateManagerMemory compatibility
Mainly this just makes it easier for us to write tests that work against either
Disk or Memory state managers.
* bundle chakra in window for CSR
* remove repeated chakra ui reference
* use dynamically generated libraries
* remove js from it
* include emotion react for dynamic components
* make code more readable
Co-authored-by: Thomas Brandého <thomas.brandeho@gmail.com>
* jsx yea
* what
---------
Co-authored-by: Thomas Brandého <thomas.brandeho@gmail.com>
* Add additional test cases for rx.call_script
Include internal vars inside an f-string to be properly rendered on the backend
and frontend.
* [ENG-3870] rx.call_script with f-string var produces incorrect code
Avoid casting javascript code with embedded Var as LiteralStringVar
There are two cases that need to be handled:
1. The javascript code contains Vars with VarData, these can only be evaluated
in the component context, since they may use hooks. Vars with VarData cannot be
used from the backend. In this case, we cast the given code as a raw js
expression and include the extracted VarData.
2. The javascript code has no VarData. In this case, we pass the code as the
raw js expression and cast to a python str to get a js literal string to eval.
* use VarData.__bool__ instead of `is None`
* use pathlib as much as possible
* fixstuff
* break locally to unbreak in CI 🤷
* add type on env
* debug attempt 1
* debugged
* oops, there is the actual fix
* fix 3.9 compat