reflex/reflex
Masen Furer c636c91c9c
[REF-2273] Implement .setvar special EventHandler (#3163)
* Allow EventHandler args to be partially applied

When an EventHandler is called with an incomplete set of args it creates a
partial EventSpec. This change allows Component._create_event_chain to apply
remaining args from an args_spec to an existing EventSpec to make it
functional.

Instead of requiring the use of `lambda` functions to pass arguments to an
EventHandler, they can now be passed directly and any remaining args defined in
the event trigger will be applied after those.

* [REF-2273] Implement `.setvar` special EventHandler

All State subclasses will now have a special `setvar` EventHandler which
appears in the autocomplete drop down, passes static analysis, and canbe used
to set State Vars in response to event triggers.

Before:
    rx.input(value=State.a, on_change=State.set_a)

After:
    rx.input(value=State.a, on_change=State.setvar("a"))

This reduces the "magic" because `setvar` is statically defined on all State
subclasses.

* Catch invalid Var names and types at compile time

* Add test cases for State.setvar

* Use a proper redis-compatible token
2024-05-01 17:13:55 -07:00
..
.templates Implement throttle and debounce as event actions (#3091) 2024-04-26 17:28:51 -07:00
compiler Allow StatefulComponent to also be rendered via __str__ (#3211) 2024-05-01 17:03:40 -07:00
components [REF-2273] Implement .setvar special EventHandler (#3163) 2024-05-01 17:13:55 -07:00
constants Windows Pin Bun version (#3192) 2024-05-01 14:47:03 -07:00
custom_components custom component install as editable mode (#3200) 2024-04-30 18:12:16 -07:00
experimental Experimental layout components (#3066) 2024-04-18 10:54:19 -07:00
middleware feat: Synchronizing localStorage between tabs using browser events (#2533) 2024-02-20 15:14:55 -08:00
utils Windows Pin Bun version (#3192) 2024-05-01 14:47:03 -07:00
__init__.py [REF-2523] Implement new public Component API (#3203) 2024-05-01 14:46:27 -07:00
__init__.pyi [REF-2523] Implement new public Component API (#3203) 2024-05-01 14:46:27 -07:00
__main__.py add __main__ entry point to allow python -m reflex (#1516) 2023-08-03 14:26:50 -07:00
admin.py Allow view overrides for registering models with admin (#1249) 2023-06-27 14:08:09 -07:00
app_module_for_backend.py [REF-2172] Add DECORATED_PAGES before compiling in thread (#2841) 2024-03-12 10:28:37 -07:00
app.py Fixed unused kwargs in reflex.App (#3170) 2024-04-29 13:53:27 -07:00
app.pyi fix: args issue in __init__ of App class (#3140) (#3141) 2024-04-22 15:43:16 -07:00
base.py [REF-2127] Loosen requirements (#2796) 2024-03-29 09:26:53 -07:00
config.py Lendemor/improve coverage (#2988) 2024-04-04 14:31:43 +02:00
config.pyi Lendemor/improve coverage (#2988) 2024-04-04 14:31:43 +02:00
event.py [REF-2273] Implement .setvar special EventHandler (#3163) 2024-05-01 17:13:55 -07:00
model.py Force pydantic v1 for sqlmodel compatibility (#3026) 2024-04-11 13:42:30 -07:00
page.py separate DECORATED_PAGES per reflex app (#3102) 2024-04-22 11:32:31 -07:00
reflex.py ruff-format: unify Black with Ruff v0.1 (#2837) 2024-04-23 14:40:06 -07:00
route.py [REF-1741] Disallow routes with /api prefix (#2711) 2024-02-26 19:34:51 -08:00
state.py [REF-2273] Implement .setvar special EventHandler (#3163) 2024-05-01 17:13:55 -07:00
style.py [REF-2574] Default width for Stack (+children) and default padding for container (#3104) 2024-04-30 13:15:57 -07:00
testing.py Integration testing: Firefox compatibility (#3162) 2024-04-26 13:44:08 -07:00
vars.py extend rx.input allowed types (#3149) 2024-04-24 16:04:56 -07:00
vars.pyi use dict instead of set to store hooks (#2995) 2024-04-03 17:13:42 -07:00