Instead of potentially defining `_LANGUAGE` constant twice in a component,
simply pass the language prop directly to the hook generator function.
If no language is passed, then it defaults to `_LANGUAGE`, which continues to
work for markdown component_map use case.
* unbreak link _hover
* add a test to catch the error
* change tmp path for harness
* add () to fixture
* add spacer to avoid initial hover
* only install chromium browser for faster ci
---------
Co-authored-by: Lendemor <thomas.brandeho@gmail.com>
* Enable automatic retry on redis errors
ExponentialBackoff 3x retry for BusyLoadingError, ConnectionError, and TimeoutError
* retry on any redis error
* Use default single-retry for any RedisError
Using the default Retry means that async and sync clients get the appropriate type of Retry
* use position in vardata to mark internal hooks
* update all render to use position
* use macros for rendering
* reduce number of iterations over hooks during rendering
* cleanup code and add typing
* add __future__
* use new macros to render component maps in markdown
* remove calls to _get_all_hooks_internal
* fix typo
* forgot to replace this
* unnecessary expand in utils.py
DeprecationWarning: Default non-cached rx.var has been deprecated in version
0.6.8 the default value will be `@rx.var(cache=True)` in a future release. To
retain uncached var, explicitly pass `@rx.var(cache=False)`. It will be
completely removed in 0.7.0
* [ENG-2157] [Refix] Allow `rx.download` to resolve `rx.get_upload_url`
Update the special case in a way that works with the new Var system and its
unstoppable determination to concatenate strings instead of using template
string
This has been broken since 0.6.0, so a regression test was added to avoid
future inadvertant breakage.
Fix#2812 (again)
* use safer indirect eval
* Proxy backend requests on '/' to the frontend
If the optional extra `proxy` is installed, then the backend can handle all
requests by proxy unrecognized routes to the frontend nextjs server.
* Update lock file
* pre-commit fu
* AppHarness: set config frontend_port and backend_port
* integration: frontend port and backend port should return the same content
with proxying enabled by default in dev mode, both frontend and backend ports
on / should return the same content.
* Retry up to 100 times when proxying to frontend
* Reduce retry attempts to 25
Fix log level passing to subprocess
* scripts/wait_for_listening_port: primarily check HTTP responses
if the port is up or not, we don't really care... the HTTP request needs to
work and not return errors
* aiohttp is an optional dep
* adapt integration.sh for --backend-only (counter integration test)
* woops
* windows WTF?
* scratching my head 🎄
* double WTF windows
* Fix remaining integration tests
The default behavior for EventSpec is to treat the spec as a partial, wherein
if additional unfilled arguments are available, and the event trigger wants to
pass additional arguments, they will be applied positionally.
However, it never makes sense to fill in `callback` with an event trigger arg.
Therefore, if the callback is not provided initially, set it to None explicitly
so that some invalid value cannot be added later.
* BaseState.get_var_value helper to get a value from a Var
When given a state Var or a LiteralVar, retrieve the actual value associated
with the Var.
For state Vars, the returned value is directly tied to the associated state and
can be modified.
Modifying LiteralVar values or ComputedVar values will have no useful effect.
* Use Var[VAR_TYPE] annotation to take advantage of generics
This requires rx.Field to pass typing where used.
* Add case where get_var_value gets something that's not a var
* [ENG-4083] Track internal changes in dataclass instances
Create a dynamic subclass of MutableProxy with `__dataclass_fields__` set
according to the dataclass being wrapped.
* support dataclasses.asdict on MutableProxy instances
The ability to convert `EventType` arguments into `EventChain` is crucial for
wrapping JS libraries that need to pass event handlers via hooks or
other non-component centric interfaces.
Improve typing such that wrapped components accepting `EventType` arguments can
be directly converted to `EventChain` / `EventChainVar` to be rendered as JS
code.
* fix memoized event trigger order
* allow to declare deps in event signature for memoized event triggers
* clean up the code to pass tests
* handle position of hooks
* clean up code
* revert test changes
* add future annotations
* remove non-necessary stuff
* reuse data_callback name if already set during first call to add_hooks
* remove HookVar and use Var with VarData instead
* remove test change
* readd removed line
* fix order of stmt for cleaner code
* fix typing
* something broke during the merge I guess
* remove hack and pass proper const for position
* oops, bad syntax in jinja
* use "hook_position" instead of "hook_positions"
match the name of the enum
---------
Co-authored-by: Masen Furer <m_github@0x26.net>
* add datetime var operations
* add future annotations
* add LiteralDatetimeVar
* remove methods that don't apply
* fix serialization
* add unit and integrations test
* oops, forgot to commit that important change
* Include step attribute in input
* Remove `step` prop from TextField
it is inherited from Input, and does not need to be redefined
---------
Co-authored-by: Masen Furer <m_github@0x26.net>
* Use empty string for None values in `rx.input` and `rx.el.input`
* fix tests
* fix pyi scripts
* use nullish coalescing operator
* fix unit tests
* use ternary operator so old browsers and dynamic components tests pass
* address comment on doing this only for optionals
* Fix tests
* pyright!
* fix comments
* Throw warnings when Redis lock is held for more than the allowed threshold
* initial tests
* fix tests and address comments
* fix tests fr, and use pydantic validators
* darglint fix
* increase lock expiration in tests to 2500
* remove print statement
---------
Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
* [ENG-4165] Consider default and default_factory for state vars
When determining whether a state var should be marked as optional, check that
it is missing both default and default_factory and is not required.
Fix#4471
* add test for default factory with rx.foreach (#4515)
---------
Co-authored-by: benedikt-bartscher <31854409+benedikt-bartscher@users.noreply.github.com>
* Avoid double JSON encode/decode for socket.io
socket.io (python and js) already has a built in mechanism for JSON encoding
and decoding messages over the websocket. To use it, we pass a custom `json`
namespace which uses `format.json_dumps` (leveraging reflex serializers) to encode the
messages. This avoids sending a JSON-encoded string of JSON over the wire, and
reduces the number of serialization/deserialization passes over the message
data.
The side benefit is that debugging websocket messages in browser tools displays
the parsed JSON hierarchy and is much easier to work with.
* JSON5.parse in on_upload_progress handler responses
* use `macos-latest` runner
macos-12 is deprecated and the jobs don't start anymore, so see if we can run
fine on latest.
* unit_tests.yml: use python versions with arm64 builds