reflex 0.6.6a1__py3-none-any.whl → 0.6.6a3__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.

@@ -454,6 +454,10 @@ export const connect = async (
454
454
  queueEvents(update.events, socket);
455
455
  }
456
456
  });
457
+ socket.current.on("reload", async (event) => {
458
+ event_processing = false;
459
+ queueEvents([...initialEvents(), JSON5.parse(event)], socket);
460
+ })
457
461
 
458
462
  document.addEventListener("visibilitychange", checkVisibility);
459
463
  };
reflex/app.py CHANGED
@@ -73,6 +73,7 @@ from reflex.event import (
73
73
  EventSpec,
74
74
  EventType,
75
75
  IndividualEventType,
76
+ get_hydrate_event,
76
77
  window_alert,
77
78
  )
78
79
  from reflex.model import Model, get_db_status
@@ -1259,6 +1260,21 @@ async def process(
1259
1260
  )
1260
1261
  # Get the state for the session exclusively.
1261
1262
  async with app.state_manager.modify_state(event.substate_token) as state:
1263
+ # When this is a brand new instance of the state, signal the
1264
+ # frontend to reload before processing it.
1265
+ if (
1266
+ not state.router_data
1267
+ and event.name != get_hydrate_event(state)
1268
+ and app.event_namespace is not None
1269
+ ):
1270
+ await asyncio.create_task(
1271
+ app.event_namespace.emit(
1272
+ "reload",
1273
+ data=format.json_dumps(event),
1274
+ to=sid,
1275
+ )
1276
+ )
1277
+ return
1262
1278
  # re-assign only when the value is different
1263
1279
  if state.router_data != router_data:
1264
1280
  # assignment will recurse into substates and force recalculation of
@@ -1462,10 +1478,10 @@ class EventNamespace(AsyncNamespace):
1462
1478
  app: App
1463
1479
 
1464
1480
  # Keep a mapping between socket ID and client token.
1465
- token_to_sid: dict[str, str] = {}
1481
+ token_to_sid: dict[str, str]
1466
1482
 
1467
1483
  # Keep a mapping between client token and socket ID.
1468
- sid_to_token: dict[str, str] = {}
1484
+ sid_to_token: dict[str, str]
1469
1485
 
1470
1486
  def __init__(self, namespace: str, app: App):
1471
1487
  """Initialize the event namespace.
@@ -1475,6 +1491,8 @@ class EventNamespace(AsyncNamespace):
1475
1491
  app: The application object.
1476
1492
  """
1477
1493
  super().__init__(namespace)
1494
+ self.token_to_sid = {}
1495
+ self.sid_to_token = {}
1478
1496
  self.app = app
1479
1497
 
1480
1498
  def on_connect(self, sid, environ):
@@ -255,7 +255,7 @@ const extractPoints = (points) => {
255
255
 
256
256
  def _render(self):
257
257
  tag = super()._render()
258
- figure = self.data.to(dict)
258
+ figure = self.data.to(dict) if self.data is not None else Var.create({})
259
259
  merge_dicts = [] # Data will be merged and spread from these dict Vars
260
260
  if self.layout is not None:
261
261
  # Why is this not a literal dict? Great question... it didn't work
@@ -3,7 +3,6 @@
3
3
  from typing import Dict, Literal
4
4
 
5
5
  from reflex.components.component import Component, MemoizationLeaf, NoSSRComponent
6
- from reflex.utils import console
7
6
 
8
7
 
9
8
  class Recharts(Component):
@@ -11,19 +10,8 @@ class Recharts(Component):
11
10
 
12
11
  library = "recharts@2.13.0"
13
12
 
14
- def render(self) -> Dict:
15
- """Render the tag.
16
-
17
- Returns:
18
- The rendered tag.
19
- """
20
- tag = super().render()
21
- if any(p.startswith("css") for p in tag["props"]):
22
- console.warn(
23
- f"CSS props do not work for {self.__class__.__name__}. Consult docs to style it with its own prop."
24
- )
25
- tag["props"] = [p for p in tag["props"] if not p.startswith("css")]
26
- return tag
13
+ def _get_style(self) -> Dict:
14
+ return {"wrapperStyle": self.style}
27
15
 
28
16
 
29
17
  class RechartsCharts(NoSSRComponent, MemoizationLeaf):
@@ -11,7 +11,6 @@ from reflex.style import Style
11
11
  from reflex.vars.base import Var
12
12
 
13
13
  class Recharts(Component):
14
- def render(self) -> Dict: ...
15
14
  @overload
16
15
  @classmethod
17
16
  def create( # type: ignore
reflex/reflex.py CHANGED
@@ -404,7 +404,7 @@ def logoutv2(
404
404
 
405
405
  hosting.log_out_on_browser()
406
406
  console.debug("Deleting access token from config locally")
407
- hosting.delete_token_from_config(include_invitation_code=True)
407
+ hosting.delete_token_from_config()
408
408
 
409
409
 
410
410
  db_cli = typer.Typer()
reflex/state.py CHANGED
@@ -1748,7 +1748,11 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1748
1748
  if value is None:
1749
1749
  continue
1750
1750
  hinted_args = value_inside_optional(hinted_args)
1751
- if isinstance(value, dict) and inspect.isclass(hinted_args):
1751
+ if (
1752
+ isinstance(value, dict)
1753
+ and inspect.isclass(hinted_args)
1754
+ and not types.is_generic_alias(hinted_args) # py3.9-py3.10
1755
+ ):
1752
1756
  if issubclass(hinted_args, Model):
1753
1757
  # Remove non-fields from the payload
1754
1758
  payload[arg] = hinted_args(
@@ -1759,7 +1763,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1759
1763
  }
1760
1764
  )
1761
1765
  elif dataclasses.is_dataclass(hinted_args) or issubclass(
1762
- hinted_args, Base
1766
+ hinted_args, (Base, BaseModelV1, BaseModelV2)
1763
1767
  ):
1764
1768
  payload[arg] = hinted_args(**value)
1765
1769
  if isinstance(value, list) and (hinted_args is set or hinted_args is Set):
@@ -1955,6 +1959,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1955
1959
  if var in self.base_vars or var in self._backend_vars:
1956
1960
  self._was_touched = True
1957
1961
  break
1962
+ if var == constants.ROUTER_DATA and self.parent_state is None:
1963
+ self._was_touched = True
1964
+ break
1958
1965
 
1959
1966
  def _get_was_touched(self) -> bool:
1960
1967
  """Check current dirty_vars and flag to determine if state instance was modified.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: reflex
3
- Version: 0.6.6a1
3
+ Version: 0.6.6a3
4
4
  Summary: Web apps in pure Python.
5
5
  Home-page: https://reflex.dev
6
6
  License: Apache-2.0
@@ -34,12 +34,12 @@ reflex/.templates/web/utils/helpers/debounce.js,sha256=xGhtTRtS_xIcaeqnYVvYJNseL
34
34
  reflex/.templates/web/utils/helpers/paste.js,sha256=ef30HsR83jRzzvZnl8yV79yqFP8TC_u8SlN99cCS_OM,1799
35
35
  reflex/.templates/web/utils/helpers/range.js,sha256=FevdZzCVxjF57ullfjpcUpeOXRxh5v09YnBB0jPbrS4,1152
36
36
  reflex/.templates/web/utils/helpers/throttle.js,sha256=qxeyaEojaTeX36FPGftzVWrzDsRQU4iqg3U9RJz9Vj4,566
37
- reflex/.templates/web/utils/state.js,sha256=oNConr9R6v2pSlZTcxO9D3qkXZMWCyQHn3iG8IERF-0,28031
37
+ reflex/.templates/web/utils/state.js,sha256=16mswYQ40ly3uUTBVeMRxq0KFdSVkN20zVj2Pml5zn8,28182
38
38
  reflex/__init__.py,sha256=4R4EdOqGs60L9YmqrOpVhm39VDOpF9sGQ6ir4S-YGiY,10708
39
39
  reflex/__init__.pyi,sha256=K-xiTA024j_a9twP4H8nmbl82GGskoyQ66FJ2QqyXl4,11233
40
40
  reflex/__main__.py,sha256=6cVrGEyT3j3tEvlEVUatpaYfbB5EF3UVY-6vc_Z7-hw,108
41
41
  reflex/admin.py,sha256=_3pkkauMiTGJJ0kwAEBnsUWAgZZ_1WNnCaaObbhpmUI,374
42
- reflex/app.py,sha256=UtJWlkIhybwSF5W2qypkvekMnqtfvwHmW1SDkkG-G9Q,54698
42
+ reflex/app.py,sha256=erCrSNFoNPnVLocomDVDQC9GfCAB0h3J8BqRDCi1Log,55355
43
43
  reflex/app_mixins/__init__.py,sha256=Oegz3-gZLP9p2OAN5ALNbsgxuNQfS6lGZgQA8cc-9mQ,137
44
44
  reflex/app_mixins/lifespan.py,sha256=IG72wp1Kas2polEP6Y1nB0wFPN3J4Kh0JAHvbQ-7wZ8,3185
45
45
  reflex/app_mixins/middleware.py,sha256=V5J06Ux9qZIHFX0pnz8qd3EuHHI8KIvtEKpfave_kjI,3209
@@ -159,7 +159,7 @@ reflex/components/next/link.pyi,sha256=A8jQIkj-vHrDqTVbuam3Y8eazLHGwqhynqLYr_9Nv
159
159
  reflex/components/next/video.py,sha256=GngxgHvAfGwRHkPUBNp6_GfGarP5mMN6KFA_-VizDOI,735
160
160
  reflex/components/next/video.pyi,sha256=JOmKt7-I20YlF_htFI-H5RpOM_9dMw16IShFG52xtRA,2556
161
161
  reflex/components/plotly/__init__.py,sha256=OX-Ly11fIg0uRTQHfqNVKV4M9xqMqLOqXzZIfKNYE0w,77
162
- reflex/components/plotly/plotly.py,sha256=TAjHwZaZsYQC1bvbF4vq23AMFtFxudx6mnEC8DO4058,8715
162
+ reflex/components/plotly/plotly.py,sha256=p3BU476paTJEmCpL0IKniH6eR6VCc7ue8S_cDrmYrKY,8760
163
163
  reflex/components/plotly/plotly.pyi,sha256=BZGDMPg8aJmKJX2E_dtHOULR4Oz3tJLR279YMxdHz8k,7284
164
164
  reflex/components/props.py,sha256=mBwSby1aFmpnD3gfy92pqFITvNikj0hSE6HUMa5sBm4,2482
165
165
  reflex/components/radix/__init__.py,sha256=fRsLvIO3MrTtPOXtmnxYDB9phvzlcbyB_utgpafYMho,474
@@ -308,8 +308,8 @@ reflex/components/recharts/general.py,sha256=G-uqoJ-wltsZS0lr-KkUjawfIbBr-pNIPBm
308
308
  reflex/components/recharts/general.pyi,sha256=vnRsLUIG5Ll7Vc4VNvtVaXMocoCoAsM0ip7wGYR2WCA,23243
309
309
  reflex/components/recharts/polar.py,sha256=JYwfQnTmda6Keml5iWrGv0-eV-KNIgkYJybWtkl9Ik0,15688
310
310
  reflex/components/recharts/polar.pyi,sha256=jAvLHbSaRQ-81wpDvlsVjh4mMKbcN5L7qyrQqe6181w,29429
311
- reflex/components/recharts/recharts.py,sha256=r3Fry0eE7vgonOvlOG-FrRlqDtyjowoyXG7rN5iZdHA,3595
312
- reflex/components/recharts/recharts.pyi,sha256=xwD-dYxpf4Jw8-F2JIFoCpjr8J4LVS6e2YkRKeRB_i0,7178
311
+ reflex/components/recharts/recharts.py,sha256=zzsyo668aRZUX8aAKmf_cSfMlVD97frco4-HkmpL1yI,3182
312
+ reflex/components/recharts/recharts.pyi,sha256=vPy4O4kAWG8hGrvqI6nKcr22L5OEDMb3P4zcSOnAVj4,7144
313
313
  reflex/components/sonner/__init__.py,sha256=L_mdRIy7-ccRGSz5VK6J8O-c-e-D1p9xWw29_ErrvGg,68
314
314
  reflex/components/sonner/toast.py,sha256=I43ktNqYUZoyJckk9KhQdx9s_M4Fhxez05VXZq0p6RA,11620
315
315
  reflex/components/sonner/toast.pyi,sha256=qUQVdvY5_wC8ng8CJQJnZO--6zhcjw8dEx5TKIyaDZk,7557
@@ -356,9 +356,9 @@ reflex/middleware/hydrate_middleware.py,sha256=KvFppl4ca75bsjos5boy8EGwsRBZ9jI6Z
356
356
  reflex/middleware/middleware.py,sha256=9eASK3MrbK1AvT2Sx5GFxXNwSuNW8_LTRGvPY1JccU4,1171
357
357
  reflex/model.py,sha256=AaCs6V9iWFj-EZI7zfXL1LTy-TrnNfJKVit2MPqLM8M,14139
358
358
  reflex/page.py,sha256=N85R5tTI-NoFd9ArwYCN8OcV9aSPZIPrJI2ZFbH8ytk,2389
359
- reflex/reflex.py,sha256=mTfc1GpG8QxpctjCwvkr5xuUsfXWIsRZwjiYUKb-t3Y,21896
359
+ reflex/reflex.py,sha256=ejJKZDYscjCYL1lMIPmPCbvqd5Gosw4FwbRsupyEIm4,21868
360
360
  reflex/route.py,sha256=WZS7stKgO94nekFFYHaOqNgN3zZGpJb3YpGF4ViTHmw,4198
361
- reflex/state.py,sha256=PR7ACv96OfssFazmMsKoQe5XMP7Cu8a2i1MuL-oJH6M,133929
361
+ reflex/state.py,sha256=qFeY7g8SUovb3V-QNcoWS47eG4S4Y4_WV8gFb6rrJBI,134231
362
362
  reflex/style.py,sha256=-mBrpaq23jiNJIwgCir6Fzj182u9rGpp3qZ2cUt5aZs,12695
363
363
  reflex/testing.py,sha256=qkLVNeLcD3uxTg95WuV1IYoEhkmEdJ7o8Fbc8NaeoRQ,34792
364
364
  reflex/utils/__init__.py,sha256=y-AHKiRQAhk2oAkvn7W8cRVTZVK625ff8tTwvZtO7S4,24
@@ -388,8 +388,8 @@ reflex/vars/function.py,sha256=w_Xa7GGVHbcfP7nMqKG5-q9Y7Uj3Yinj1Csjqxz_leg,14596
388
388
  reflex/vars/number.py,sha256=BeHQr4Cj2gdXekEWcxSzLTIuRAC3sf6YvsdHlADETpQ,27499
389
389
  reflex/vars/object.py,sha256=dTfkkUGDmoxu7iPcKSnNJ-lTI48yoXbagUyA-lKwDDo,14335
390
390
  reflex/vars/sequence.py,sha256=mlmOkSV8FIxwdJHzQdu3NzHAoNB4KcGc93dcmdviIoo,49916
391
- reflex-0.6.6a1.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
392
- reflex-0.6.6a1.dist-info/METADATA,sha256=-0e9vXm_gZ0wV_W7GVf5bd6yeCLQuEMQoyfQnpZjPqo,12101
393
- reflex-0.6.6a1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
394
- reflex-0.6.6a1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
395
- reflex-0.6.6a1.dist-info/RECORD,,
391
+ reflex-0.6.6a3.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
392
+ reflex-0.6.6a3.dist-info/METADATA,sha256=AklydJ0ckgv6M0hyRShNCQxdCKPc8Og9a5ZAhpGdBMs,12101
393
+ reflex-0.6.6a3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
394
+ reflex-0.6.6a3.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
395
+ reflex-0.6.6a3.dist-info/RECORD,,