reflex 0.7.9a1__py3-none-any.whl → 0.7.9a2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of reflex might be problematic. Click here for more details.

@@ -243,13 +243,13 @@ export const applyEvent = async (event, socket) => {
243
243
  if (event.name == "_set_focus") {
244
244
  const ref =
245
245
  event.payload.ref in refs ? refs[event.payload.ref] : event.payload.ref;
246
- const focus = ref?.current?.focus;
247
- if (focus === undefined) {
246
+ const current = ref?.current;
247
+ if (current === undefined || current?.focus === undefined) {
248
248
  console.error(
249
249
  `No element found for ref ${event.payload.ref} in _set_focus`,
250
250
  );
251
251
  } else {
252
- focus();
252
+ current.focus();
253
253
  }
254
254
  return false;
255
255
  }
reflex/app.py CHANGED
@@ -489,7 +489,7 @@ class App(MiddlewareMixin, LifespanMixin):
489
489
 
490
490
  # Set up the API.
491
491
  self._api = Starlette(lifespan=self._run_lifespan_tasks)
492
- self._add_cors()
492
+ App._add_cors(self._api)
493
493
  self._add_default_endpoints()
494
494
 
495
495
  for clz in App.__mro__:
@@ -613,19 +613,6 @@ class App(MiddlewareMixin, LifespanMixin):
613
613
  Returns:
614
614
  The backend api.
615
615
  """
616
- if self._cached_fastapi_app is not None:
617
- asgi_app = self._cached_fastapi_app
618
-
619
- if not asgi_app or not self._api:
620
- raise ValueError("The app has not been initialized.")
621
-
622
- asgi_app.mount("", self._api)
623
- else:
624
- asgi_app = self._api
625
-
626
- if not asgi_app:
627
- raise ValueError("The app has not been initialized.")
628
-
629
616
  # For py3.9 compatibility when redis is used, we MUST add any decorator pages
630
617
  # before compiling the app in a thread to avoid event loop error (REF-2172).
631
618
  self._apply_decorated_pages()
@@ -637,9 +624,17 @@ class App(MiddlewareMixin, LifespanMixin):
637
624
  # Force background compile errors to print eagerly
638
625
  lambda f: f.result()
639
626
  )
640
- # Wait for the compile to finish in prod mode to ensure all optional endpoints are mounted.
641
- if is_prod_mode():
642
- compile_future.result()
627
+ # Wait for the compile to finish to ensure all optional endpoints are mounted.
628
+ compile_future.result()
629
+
630
+ if not self._api:
631
+ raise ValueError("The app has not been initialized.")
632
+ if self._cached_fastapi_app is not None:
633
+ asgi_app = self._cached_fastapi_app
634
+ asgi_app.mount("", self._api)
635
+ App._add_cors(asgi_app)
636
+ else:
637
+ asgi_app = self._api
643
638
 
644
639
  if self.api_transformer is not None:
645
640
  api_transformers: Sequence[Starlette | Callable[[ASGIApp], ASGIApp]] = (
@@ -651,6 +646,7 @@ class App(MiddlewareMixin, LifespanMixin):
651
646
  for api_transformer in api_transformers:
652
647
  if isinstance(api_transformer, Starlette):
653
648
  # Mount the api to the fastapi app.
649
+ App._add_cors(api_transformer)
654
650
  api_transformer.mount("", asgi_app)
655
651
  asgi_app = api_transformer
656
652
  else:
@@ -709,11 +705,14 @@ class App(MiddlewareMixin, LifespanMixin):
709
705
  if environment.REFLEX_ADD_ALL_ROUTES_ENDPOINT.get():
710
706
  self.add_all_routes_endpoint()
711
707
 
712
- def _add_cors(self):
713
- """Add CORS middleware to the app."""
714
- if not self._api:
715
- return
716
- self._api.add_middleware(
708
+ @staticmethod
709
+ def _add_cors(api: Starlette):
710
+ """Add CORS middleware to the app.
711
+
712
+ Args:
713
+ api: The Starlette app to add CORS middleware to.
714
+ """
715
+ api.add_middleware(
717
716
  cors.CORSMiddleware,
718
717
  allow_credentials=True,
719
718
  allow_methods=["*"],
@@ -1118,7 +1117,6 @@ class App(MiddlewareMixin, LifespanMixin):
1118
1117
  # Add the @rx.page decorated pages to collect on_load events.
1119
1118
  for render, kwargs in DECORATED_PAGES[app_name]:
1120
1119
  self.add_page(render, **kwargs)
1121
- DECORATED_PAGES[app_name].clear()
1122
1120
 
1123
1121
  def _validate_var_dependencies(self, state: type[BaseState] | None = None) -> None:
1124
1122
  """Validate the dependencies of the vars in the app.
reflex/page.py CHANGED
@@ -8,6 +8,7 @@ from typing import Any
8
8
 
9
9
  from reflex.config import get_config
10
10
  from reflex.event import EventType
11
+ from reflex.utils import console
11
12
 
12
13
  DECORATED_PAGES: dict[str, list] = defaultdict(list)
13
14
 
@@ -76,6 +77,13 @@ def get_decorated_pages(omit_implicit_routes: bool = True) -> list[dict[str, Any
76
77
  Returns:
77
78
  The decorated pages.
78
79
  """
80
+ console.deprecate(
81
+ "get_decorated_pages",
82
+ reason="This function is deprecated and will be removed in a future version.",
83
+ deprecation_version="0.7.9",
84
+ removal_version="0.8.0",
85
+ dedupe=True,
86
+ )
79
87
  return sorted(
80
88
  [
81
89
  page_data
reflex/reflex.py CHANGED
@@ -354,6 +354,7 @@ def run(
354
354
  @click.option(
355
355
  "--zip/--no-zip",
356
356
  default=True,
357
+ is_flag=True,
357
358
  help="Whether to zip the backend and frontend exports.",
358
359
  )
359
360
  @click.option(
@@ -569,7 +570,7 @@ def makemigrations(message: str | None):
569
570
  help="The hostname of the frontend.",
570
571
  )
571
572
  @click.option(
572
- "--interactive",
573
+ "--interactive/--no-interactive",
573
574
  is_flag=True,
574
575
  default=True,
575
576
  help="Whether to list configuration options and ask for confirmation.",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reflex
3
- Version: 0.7.9a1
3
+ Version: 0.7.9a2
4
4
  Summary: Web apps in pure Python.
5
5
  Project-URL: homepage, https://reflex.dev
6
6
  Project-URL: repository, https://github.com/reflex-dev/reflex
@@ -2,15 +2,15 @@ reflex/__init__.py,sha256=viEt38jc1skwOUBwwlwPL02hcGrm9xNQzKExVftZEx4,10365
2
2
  reflex/__init__.pyi,sha256=h9ltlhaz1dySsNYpUkN_VCjEzHGfb1h18ThYh15QjyU,11358
3
3
  reflex/__main__.py,sha256=6cVrGEyT3j3tEvlEVUatpaYfbB5EF3UVY-6vc_Z7-hw,108
4
4
  reflex/admin.py,sha256=Nbc38y-M8iaRBvh1W6DQu_D3kEhO8JFvxrog4q2cB_E,434
5
- reflex/app.py,sha256=SzOerVTRmSGZfwiANJeysQuuPshUbc2-yFTa95wHckA,73606
5
+ reflex/app.py,sha256=46nFXGVDIvptbReSnCFZ6le4NCXkI9BFnKJ_bidxU4M,73552
6
6
  reflex/assets.py,sha256=PLTKAMYPKMZq8eWXKX8uco6NZ9IiPGWal0bOPLUmU7k,3364
7
7
  reflex/base.py,sha256=U7i_ijkbSLUDm1TlTYYZEm5P6ZiVO1aIT1MJKXO6V1o,3881
8
8
  reflex/config.py,sha256=g2t8W07Yq7OFBzEFp5lsy2V6p977hCO872gxPpSDZSU,35521
9
9
  reflex/event.py,sha256=_1ViwJFQ3wnQgf1_SP7SdUHeI7qoz62o18gaxPoIGyg,63403
10
10
  reflex/model.py,sha256=eOWc157txBIUmYMZqQeKKdn2dm4Tsf8h8CbqeLXvjeg,17577
11
- reflex/page.py,sha256=QUdf3dtlTj0Yoq7KPwFHexRgEddlhSTGfSqxcR8OXXQ,2407
11
+ reflex/page.py,sha256=mqioadLDsABvfNqdLbxvUKqi1gulSKddMihZe3pjtdc,2678
12
12
  reflex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- reflex/reflex.py,sha256=T3bAFl3GUhmb7rCR9OH5Gl6QZfhvvUGLdTuj7AtBWUg,20837
13
+ reflex/reflex.py,sha256=-4xW2AnbJUKc6v9jsgmuhtObkZHmtUNtQW7sPU7Do44,20872
14
14
  reflex/route.py,sha256=nn_hJwtQdjiqH_dHXfqMGWKllnyPQZTSR-KWdHDhoOs,4210
15
15
  reflex/state.py,sha256=JfwlsoFUzHnfJM8GLAFXw5K_UwK5wJOsetljx6hU6gk,142341
16
16
  reflex/style.py,sha256=8ciwcReoKSrPSwoteXJwv7YTK514tf7jrJ5RfqztmvA,13186
@@ -47,7 +47,7 @@ reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js,sha2
47
47
  reflex/.templates/web/components/shiki/code.js,sha256=UO0hQnm2w1j2VMgj46cnplO6ZLK3p3qhcxp6irjZBxQ,1116
48
48
  reflex/.templates/web/styles/tailwind.css,sha256=wGOoICTy1G0e5bWZ4LYOVgRa3ZT7M44tC4g6CKh6ZPo,112
49
49
  reflex/.templates/web/utils/client_side_routing.js,sha256=cOu4wUHDQtGl1yo5goxljZ94SLZLyr9R3S9Rehcvjio,1475
50
- reflex/.templates/web/utils/state.js,sha256=hJtgAPCQSTQ0Ji2xbFp1mJuBodPW4eX18s48q7V_hDM,31456
50
+ reflex/.templates/web/utils/state.js,sha256=IOA9QGupgpViVCn1gVmLiNPEi_oXdQIT73qm_0y3xgo,31493
51
51
  reflex/.templates/web/utils/helpers/dataeditor.js,sha256=pG6MgsHuStDR7-qPipzfiK32j9bKDBa-4hZ0JSUo4JM,1623
52
52
  reflex/.templates/web/utils/helpers/debounce.js,sha256=xGhtTRtS_xIcaeqnYVvYJNseLgQVk-DW-eFiHJYO9As,528
53
53
  reflex/.templates/web/utils/helpers/paste.js,sha256=ef30HsR83jRzzvZnl8yV79yqFP8TC_u8SlN99cCS_OM,1799
@@ -397,8 +397,8 @@ reflex/vars/function.py,sha256=0i-VkxHkDJmZtfQUwUfaF0rlS6WM8azjwQ8k7rEOkyk,13944
397
397
  reflex/vars/number.py,sha256=N-ZeV_ebriaFpuRf8IL7TT3D4h2ti-MUYMOISEw4N8k,27846
398
398
  reflex/vars/object.py,sha256=P_BBOxP4Z53IiHPVx5-P279lFEwdEIYLWcqO_h1UyLo,17134
399
399
  reflex/vars/sequence.py,sha256=N0BwsYbFC4KkeC-N0Bc2NcKyfrbIxGh5FIWDy7Jl7Fs,55192
400
- reflex-0.7.9a1.dist-info/METADATA,sha256=jzH6mNEOstlJ7cY4X9oMOKu-1tMtyrECDufM5RKbS0k,11728
401
- reflex-0.7.9a1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
402
- reflex-0.7.9a1.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
403
- reflex-0.7.9a1.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
404
- reflex-0.7.9a1.dist-info/RECORD,,
400
+ reflex-0.7.9a2.dist-info/METADATA,sha256=5grGCG-mMsON7v8J_mqNwpge7chklwea1GBDe62AjWM,11728
401
+ reflex-0.7.9a2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
402
+ reflex-0.7.9a2.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
403
+ reflex-0.7.9a2.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
404
+ reflex-0.7.9a2.dist-info/RECORD,,