Commit Graph

1630 Commits

Author SHA1 Message Date
Masen Furer
72465a7728
bump to 0.5.9 (#3746) 2024-08-06 16:20:15 -07:00
Masen Furer
3309c0e533
Use ._is_mutable() to account for parent state proxy (#3739)
When a parent state proxy is set, also allow child StateProxy._self_mutable to
override the parent's `_is_mutable()`.
2024-08-05 14:03:49 -07:00
Masen Furer
7d9ed7e2ce
Use the new state name when setting is_hydrated to false (#3738) 2024-08-05 14:03:30 -07:00
Manas Gupta
c7e30522bc
fix: add verification for path /404 (#3723)
Co-authored-by: coolstorm <manas.gupta@fampay.in>
2024-08-05 14:02:47 -07:00
Alek Petuskey
76627c2076
Add comments to html metadata component (#3731) 2024-08-01 13:24:39 -07:00
Khaleel Al-Adhami
ad14f38329
add type hinting to existing types (#3729)
* add type hinting to existing types

* dang it darglint

* i cannot
2024-07-31 12:01:17 -07:00
benedikt-bartscher
129adc941a
add test for initial state dict (#3727) 2024-07-31 11:37:53 -07:00
benedikt-bartscher
2629366b23
fix initial_value for computed_var (#3726)
* fix initial_value for computed_var

* fix initial_value in pyi
2024-07-31 10:00:52 -07:00
Khaleel Al-Adhami
1c400043c6
[REF-3328] Implement __getitem__ for ArrayVar (#3705)
* half of the way there

* implement __getitem__ for array

* add some tests

* add fixes to pyright

* fix default factory

* implement array operations

* format code

* fix pyright issue

* give up

* add object operations

* add test for merge

* pyright 🥺

* use str isntead of _var_name

Co-authored-by: Masen Furer <m_github@0x26.net>

* wrong var_type

* make to much nicer

* add subclass checking

* enhance types

* use builtin list type

* improve typing even more

* i'm awaiting october

* use even better typing

* add hash, json, and guess type method

* fix pyright issues

* add a test and fix lots of errors

* fix pyright once again

* add type inference to list

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-07-30 15:38:32 -07:00
Masen Furer
06833f6d8d
[REF-3203] Find a DOM event-like object in addEvents (#3706) 2024-07-29 17:17:51 -07:00
Khaleel Al-Adhami
800685da68
fix silly bug when style is set directly to breakpoints (#3719)
* fix silly bug when style is set directly to breakpoints

* add helpful comment

Co-authored-by: Masen Furer <m_github@0x26.net>

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-07-29 16:57:33 -07:00
Masen Furer
4cdd87d851
Bump to v0.5.8 (#3716) 2024-07-29 09:52:45 -07:00
paoloemilioserra
2e726f1bb9
Update vars.py (#3659)
Prevent a validation error from pydantic/v1 that cannot find _var_name, etc. in __dataclass_fields__
2024-07-28 17:51:08 -07:00
Masen Furer
a4e3f05601
[REF-3375] useMemo on generateUUID props to maintain consistent value (#3708)
When using rx.vars.get_uuid_string_var, wrap the prop Var in `useMemo` so that
the value remains consistent across re-renders of the component.

Fix #3707
2024-07-26 17:10:08 -07:00
Thomas Brandého
c4346c2624
update init prompt to use new templates from reflex-dev/templates (#3677) 2024-07-25 10:51:44 -07:00
Thomas Brandého
d389f4b5ca
fix var warning (#3704) 2024-07-25 10:50:18 -07:00
Khaleel Al-Adhami
ede5cd1f2c
[REF-3321] implement var operation decorator (#3698)
* implement var operation decorator

* use older syntax

* use cast and older syntax

* use something even simpler

* add some tests

* use old union tactics

* that's not how you do things

* implement arithmetic operations while we're at it

* add test

* even more operations

* can't use __bool__

* thanos snap

* forgot ruff

* use default factory

* dang it darglint

* i know i should have done that but

* convert values into literalvars

* make test pass

* use older union tactics

* add test to string var

* pright why do you hate me 🥺
2024-07-25 09:34:14 -07:00
Masen Furer
0845d2ee76
[REF-3184] [REF-3339] Background task locking improvements (#3696)
* [REF-3184] Raise exception when encountering nested `async with self` blocks

Avoid deadlock when the background task already holds the mutation lock for a
given state.

* [REF-3339] get_state from background task links to StateProxy

When calling `get_state` from a background task, the resulting state instance
is wrapped in a StateProxy that is bound to the original StateProxy and shares
the same async context, lock, and mutability flag.

* If StateProxy has a _self_parent_state_proxy, retrieve the correct substate

* test_state fixup
2024-07-23 15:28:38 -07:00
Thomas Brandého
b9927b6f49
notifying frontend about backend error looks better (#3491) 2024-07-23 13:58:15 -07:00
Khaleel Al-Adhami
ea016314b0
[REF-3227] implement more literal vars (#3687)
* implement more literal vars

* fix super issue

* pyright has a bug i think

* oh we changed that

* fix docs

* literalize vars recursively

* do what masen told me :D

* use dynamic keys

* forgot .create

* adjust _var_value

* dang it darglint

* add test for serializing literal vars into js exprs

* fix silly mistake

* add  handling for var and none

* use create safe

* is none bruh

* implement function vars and do various modification

* fix None issue

* clear a lot of creates that did nothing

* add tests to function vars

* added simple fix smh

* use fconcat to make an even more complicated test
2024-07-22 12:45:23 -07:00
Elijah Ahianyo
9666244a87
[REF-3273] Add SVG circle, polygon and rect components (#3684) 2024-07-22 12:05:50 -07:00
Elijah Ahianyo
decdc857be
rx.list Dont set/hardcode list_style_position css prop (#3695) 2024-07-22 10:56:34 -07:00
Masen Furer
8b45d289bd
reflex init --ai fixups (#3691)
* reflex.build polling: catch exceptions and retry

Extend interval to 2 seconds to reduce server load.

* Add function to check if a string looks like a generation hash

* reflex init: allow --template to be a generation hash if --ai is specified
2024-07-19 14:05:53 -07:00
Thomas Brandého
921a5cd632
fix typo (#3689) 2024-07-19 18:02:50 +02:00
Masen Furer
1da606dd8e
[REF-3197] Browser init workflow (#3673) 2024-07-18 18:51:33 -07:00
Elijah Ahianyo
1bc1978c31
[REF-3135] Radix Primitive components should not ignore provided class_name prop (#3676) 2024-07-18 13:26:46 -07:00
Benyamin Zojaji
25aa0cbab1
add Persian translation and update the language links in the README.md files to include Persian (#3666) 2024-07-17 18:31:18 -07:00
Alek Petuskey
0a8b8a89b4
Benchmarking Updates (#3680)
* Benchmark test

* Lighthouse posthog

---------

Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local>
2024-07-17 17:15:13 -07:00
Khaleel Al-Adhami
458cbfac59
[REF-3228] implement LiteralStringVar and format/retrieval mechanism (#3669)
* implement LiteralStringVar and format/retrieval mechanism

* use create safe

* add cached properties to ConcatVarOperation

* fix caches

* also include self

* fix inconsistencies in typings

* use default factory not default

* add missing docstring

* experiment with immutable var data

* solve pydantic issues

* add sorted function

* missing docs

* forgot ellipses

* give up on frozen

* dang it darglint

* fix string serialization bugs and remove unused code

* add returns statement

* whitespace moment

* add simple test for string concat

* export ConcatVarOperation
2024-07-17 17:01:27 -07:00
Masen Furer
94c4c2f29f
bump to 0.5.7 (#3678) 2024-07-16 11:38:56 -07:00
Alek Petuskey
93231f8168
Improve graphing asethetic (#3611)
* Improve graphing asthetic

* Few more updates

* More style updates

* Update reflex/components/recharts/polar.py

Co-authored-by: Masen Furer <m_github@0x26.net>

* Address pr comments

* fix precommit

* Fix types

* PYI

* PYI update

---------

Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local>
Co-authored-by: Masen Furer <m_github@0x26.net>
2024-07-15 11:25:08 -07:00
lumin
ec35e4f256
feat: Improve documentation in Japanese README.md file (#3650) 2024-07-14 13:16:10 -07:00
Khaleel Al-Adhami
5b927f18d0
[REF-3222] define new JS-type var classes (#3668)
* define new JS-type var classes

* add docstring

* get rid of dataclass definitions and export all new vars

* order imports in the correct way

* only hash once
2024-07-12 14:42:08 -07:00
Manas Gupta
b04a7dab84
Update Radial Bar Component (#3662)
* add: radial bar properties

* add: generate new pyi file

* style: fix linting

---------

Co-authored-by: coolstorm <manas.gupta@fampay.in>
2024-07-12 13:29:21 -07:00
Masen Furer
0ed895cde7
debounce: pass through key and special_props (#3655)
These fields on the base Component were not being carried onto the
DebounceInput component (to be passed to the child).

Discovered while testing #3653
2024-07-12 13:27:19 -07:00
benedikt-bartscher
9663377374
cleanup unused useReducer import (#3667) 2024-07-12 12:55:25 -07:00
Elijah Ahianyo
eed0edc12a
Allow DebounceInput as child of FormControl Component (#3660) 2024-07-11 16:07:25 -07:00
benedikt-bartscher
dc33d208b4
fix Var.contains pyi (#3663) 2024-07-11 16:06:32 -07:00
benedikt-bartscher
86a2f923f6
Pkg resources deprecation (#3646)
* fix typo

* migrate pkg_resources to importlib
2024-07-11 11:22:03 -07:00
benedikt-bartscher
3c0cb3fd6a
migrate deprecated connections to net_connections (#3641)
* migrate deprecated connections to net_connections

* check for psutil version
2024-07-11 11:21:34 -07:00
benedikt-bartscher
460afc2e10
fix unclosed file (#3639) 2024-07-11 11:20:54 -07:00
Khaleel Al-Adhami
d4d077818c
[REF-3225] implement __format__ for immutable vars (#3617)
* implement format for immutable vars

* add some basic test

* make reference only after formatting

* win over pyright

* hopefully now pyright doesn't hate me

* forgot some _var_data

* i don't know how imports work

* use f_string var and remove assignments from pyi file

* override post_init to not break immutability

* add create_safe and test for it
2024-07-11 11:19:38 -07:00
benedikt-bartscher
3039b54a75
add module prefix to generated state names (#3214)
* add module prefix to state names

* fix state names in test_app

* update state names in test_state

* fix state names in test_var

* fix state name in test_component

* fix state names in test_format

* fix state names in test_foreach

* fix state names in test_cond

* fix state names in test_datatable

* fix state names in test_colors

* fix state names in test_script

* fix state names in test_match

* fix state name in event1 fixture

* fix pyright and darglint

* fix state names in state_tree

* fix state names in redis only test

* fix state names in test_client_storage

* fix state name in js template

* add `get_state_name` and `get_full_state_name` helpers for `AppHarness`

* fix state names in test_dynamic_routes

* use new state name helpers in test_client_storage

* fix state names in test_event_actions

* fix state names in test_event_chain

* fix state names in test_upload

* fix state name in test_login_flow

* fix state names in test_input

* fix state names in test_form_submit

* ruff

* validate state module names

* wtf is going on here?

* remove comments leftover from refactoring

* adjust new test_add_style_embedded_vars

* fix state name in state.js

* fix integration/test_client_state.py

new SessionStorage feature was added with more full state names that need to be formatted in

* fix pre-commit issues in test_client_storage.py

* adjust test_computed_vars

* adjust safe-guards

* fix redis tests with new exception state

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-07-11 11:13:57 -07:00
Masen Furer
d378e4a70c
benchmarks.yml: use node 18.x with reflex-web@main (#3657) 2024-07-11 10:43:09 -07:00
Thomas Brandého
7ba61ced14
Make domain props work for y_axis (#3652) 2024-07-11 10:35:34 -07:00
Thomas Brandého
4f9a75b390
add warning when using css props on recharts (#3651) 2024-07-11 10:34:39 -07:00
Masen Furer
1cfc811506
[REF-3266] Check for pydantic v1 outside of try/except (#3643)
If pydantic v1 is already installed, there is no reason to restore the original
pydantic modules, which seems to introduce subtle incompatibilities with some
pydantic versions.

Perform the pydantic version check early on and exit for v1 before doing
anything with the sys.modules.

Fix #3642
2024-07-10 12:28:39 -07:00
Tom Gotsman
4c61838608
Tom/recharts missing props (#3645)
* fix axis orientation prop

* add margin prop explanation

* active bar and on animation start

* remove data key from y-axis

* precommit and pyi generator

---------

Co-authored-by: Tom Gotsman <tomgotsman@Toms-MacBook-Pro.local>
Co-authored-by: Tom Gotsman <tomgotsman@toms-mbp.lan>
2024-07-09 18:10:51 -07:00
Jishnu N
690b719437
[REF-3160] fix rx.Var._replace raise TypeError on invalid kwargs (#3625)
* fix: unexpected kwargs raise type error, on _replace

* add: docstring for _replace, test for invalid kwargs replace

* add: parametrize var for replace test

* fix: computed_var _replace with invalid kwargs
2024-07-09 11:19:29 -07:00
Maxim Vlah
fa71edd224
Fix the error boundary (#3637)
* - added possibility to pass front- and backend exception handlers to rx.App
- wrapped the app with ErrorBoundary component to catch rendering errors

* added missing exception handler to reflex.app._process

* regenerated pyi

* fix unit tests for exception handler validation

* fix typing error in ErrorBoudary

* - fix error_bounday pyi
- minor refactoring of error boundary
- removed error boundary from 404 page

* added missing inspect module import after merging main

* fix typing error

* Clean up ErrorBoundary component

* Remove custom _render function
* Remove special imports in Component base class
* Simplify hooks for better composability

* test_exception_handlers: also test in prod mode

* fixed color prop

* fixed error boundary bug and removed hardcoding of the frontend event exception state

* formatted the code after conflict resolution

* fixed type of the error_boundary

* ruff format

---------

Co-authored-by: Maxim Vlah <m.vlah@senbax.de>
Co-authored-by: Masen Furer <m_github@0x26.net>
2024-07-09 11:19:14 -07:00