reflex 0.6.6__py3-none-any.whl → 0.6.6a1__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,10 +454,6 @@ 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
- });
461
457
 
462
458
  document.addEventListener("visibilitychange", checkVisibility);
463
459
  };
@@ -490,30 +486,23 @@ export const uploadFiles = async (
490
486
  return false;
491
487
  }
492
488
 
493
- // Track how many partial updates have been processed for this upload.
494
489
  let resp_idx = 0;
495
490
  const eventHandler = (progressEvent) => {
496
- const event_callbacks = socket._callbacks.$event;
497
- // Whenever called, responseText will contain the entire response so far.
491
+ // handle any delta / event streamed from the upload event handler
498
492
  const chunks = progressEvent.event.target.responseText.trim().split("\n");
499
- // So only process _new_ chunks beyond resp_idx.
500
493
  chunks.slice(resp_idx).map((chunk) => {
501
- event_callbacks.map((f, ix) => {
502
- f(chunk)
503
- .then(() => {
504
- if (ix === event_callbacks.length - 1) {
505
- // Mark this chunk as processed.
506
- resp_idx += 1;
507
- }
508
- })
509
- .catch((e) => {
510
- if (progressEvent.progress === 1) {
511
- // Chunk may be incomplete, so only report errors when full response is available.
512
- console.log("Error parsing chunk", chunk, e);
513
- }
514
- return;
515
- });
516
- });
494
+ try {
495
+ socket._callbacks.$event.map((f) => {
496
+ f(chunk);
497
+ });
498
+ resp_idx += 1;
499
+ } catch (e) {
500
+ if (progressEvent.progress === 1) {
501
+ // Chunk may be incomplete, so only report errors when full response is available.
502
+ console.log("Error parsing chunk", chunk, e);
503
+ }
504
+ return;
505
+ }
517
506
  });
518
507
  };
519
508
 
@@ -718,7 +707,7 @@ export const useEventLoop = (
718
707
  const combined_name = events.map((e) => e.name).join("+++");
719
708
  if (event_actions?.temporal) {
720
709
  if (!socket.current || !socket.current.connected) {
721
- return; // don't queue when the backend is not connected
710
+ return; // don't queue when the backend is not connected
722
711
  }
723
712
  }
724
713
  if (event_actions?.throttle) {
@@ -859,7 +848,7 @@ export const useEventLoop = (
859
848
  if (router.components[router.pathname].error) {
860
849
  delete router.components[router.pathname].error;
861
850
  }
862
- };
851
+ }
863
852
  router.events.on("routeChangeStart", change_start);
864
853
  router.events.on("routeChangeComplete", change_complete);
865
854
  router.events.on("routeChangeError", change_error);
reflex/app.py CHANGED
@@ -73,7 +73,6 @@ from reflex.event import (
73
73
  EventSpec,
74
74
  EventType,
75
75
  IndividualEventType,
76
- get_hydrate_event,
77
76
  window_alert,
78
77
  )
79
78
  from reflex.model import Model, get_db_status
@@ -1260,21 +1259,6 @@ async def process(
1260
1259
  )
1261
1260
  # Get the state for the session exclusively.
1262
1261
  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
1278
1262
  # re-assign only when the value is different
1279
1263
  if state.router_data != router_data:
1280
1264
  # assignment will recurse into substates and force recalculation of
@@ -1478,10 +1462,10 @@ class EventNamespace(AsyncNamespace):
1478
1462
  app: App
1479
1463
 
1480
1464
  # Keep a mapping between socket ID and client token.
1481
- token_to_sid: dict[str, str]
1465
+ token_to_sid: dict[str, str] = {}
1482
1466
 
1483
1467
  # Keep a mapping between client token and socket ID.
1484
- sid_to_token: dict[str, str]
1468
+ sid_to_token: dict[str, str] = {}
1485
1469
 
1486
1470
  def __init__(self, namespace: str, app: App):
1487
1471
  """Initialize the event namespace.
@@ -1491,8 +1475,6 @@ class EventNamespace(AsyncNamespace):
1491
1475
  app: The application object.
1492
1476
  """
1493
1477
  super().__init__(namespace)
1494
- self.token_to_sid = {}
1495
- self.sid_to_token = {}
1496
1478
  self.app = app
1497
1479
 
1498
1480
  def on_connect(self, sid, environ):
@@ -293,15 +293,13 @@ class Upload(MemoizationLeaf):
293
293
  format.to_camel_case(key): value for key, value in upload_props.items()
294
294
  }
295
295
 
296
- use_dropzone_arguments = Var.create(
297
- {
298
- "onDrop": event_var,
299
- **upload_props,
300
- }
301
- )
296
+ use_dropzone_arguments = {
297
+ "onDrop": event_var,
298
+ **upload_props,
299
+ }
302
300
 
303
301
  left_side = f"const {{getRootProps: {root_props_unique_name}, getInputProps: {input_props_unique_name}}} "
304
- right_side = f"useDropzone({str(use_dropzone_arguments)})"
302
+ right_side = f"useDropzone({str(Var.create(use_dropzone_arguments))})"
305
303
 
306
304
  var_data = VarData.merge(
307
305
  VarData(
@@ -309,7 +307,6 @@ class Upload(MemoizationLeaf):
309
307
  hooks={Hooks.EVENTS: None},
310
308
  ),
311
309
  event_var._get_all_var_data(),
312
- use_dropzone_arguments._get_all_var_data(),
313
310
  VarData(
314
311
  hooks={
315
312
  callback_str: None,
@@ -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) if self.data is not None else Var.create({})
258
+ figure = self.data.to(dict)
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,6 +3,7 @@
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
6
7
 
7
8
 
8
9
  class Recharts(Component):
@@ -10,8 +11,19 @@ class Recharts(Component):
10
11
 
11
12
  library = "recharts@2.13.0"
12
13
 
13
- def _get_style(self) -> Dict:
14
- return {"wrapperStyle": self.style}
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
15
27
 
16
28
 
17
29
  class RechartsCharts(NoSSRComponent, MemoizationLeaf):
@@ -11,6 +11,7 @@ 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: ...
14
15
  @overload
15
16
  @classmethod
16
17
  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()
407
+ hosting.delete_token_from_config(include_invitation_code=True)
408
408
 
409
409
 
410
410
  db_cli = typer.Typer()
reflex/state.py CHANGED
@@ -1748,11 +1748,7 @@ 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 (
1752
- isinstance(value, dict)
1753
- and inspect.isclass(hinted_args)
1754
- and not types.is_generic_alias(hinted_args) # py3.9-py3.10
1755
- ):
1751
+ if isinstance(value, dict) and inspect.isclass(hinted_args):
1756
1752
  if issubclass(hinted_args, Model):
1757
1753
  # Remove non-fields from the payload
1758
1754
  payload[arg] = hinted_args(
@@ -1763,7 +1759,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1763
1759
  }
1764
1760
  )
1765
1761
  elif dataclasses.is_dataclass(hinted_args) or issubclass(
1766
- hinted_args, (Base, BaseModelV1, BaseModelV2)
1762
+ hinted_args, Base
1767
1763
  ):
1768
1764
  payload[arg] = hinted_args(**value)
1769
1765
  if isinstance(value, list) and (hinted_args is set or hinted_args is Set):
@@ -1959,9 +1955,6 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1959
1955
  if var in self.base_vars or var in self._backend_vars:
1960
1956
  self._was_touched = True
1961
1957
  break
1962
- if var == constants.ROUTER_DATA and self.parent_state is None:
1963
- self._was_touched = True
1964
- break
1965
1958
 
1966
1959
  def _get_was_touched(self) -> bool:
1967
1960
  """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.6
3
+ Version: 0.6.6a1
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=Js2Ufg3xfJUbqLnLdON6sC1w8Y-oC6oQQDrrluRGinU,28535
37
+ reflex/.templates/web/utils/state.js,sha256=oNConr9R6v2pSlZTcxO9D3qkXZMWCyQHn3iG8IERF-0,28031
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=erCrSNFoNPnVLocomDVDQC9GfCAB0h3J8BqRDCi1Log,55355
42
+ reflex/app.py,sha256=UtJWlkIhybwSF5W2qypkvekMnqtfvwHmW1SDkkG-G9Q,54698
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
@@ -94,7 +94,7 @@ reflex/components/core/html.pyi,sha256=VPpzNa7VORqu1IDQae4NbHXsCFzo2mELV8kIdCveN
94
94
  reflex/components/core/layout/__init__.py,sha256=znldZaj_NGt8qCZDG70GMwjMTskcvCf_2N_EjCAHwdc,30
95
95
  reflex/components/core/match.py,sha256=xhzO8LHl99Gd6yoPJ-UFZsPqilHwZJ7SWJmhly5_exE,9102
96
96
  reflex/components/core/responsive.py,sha256=ACZdtJ4a4F8B3dm1k8h6J2_UJx0Z5LDB7XHQ2ty4wAc,1911
97
- reflex/components/core/upload.py,sha256=va133I431he-08WyUhc0iJaGQ4kA1xzrFl-Ye-pBjBo,11951
97
+ reflex/components/core/upload.py,sha256=0tjo86GXSLdJlwyEc0LcstIlHg99k9OG_o4dQjsEhcU,11861
98
98
  reflex/components/core/upload.pyi,sha256=nzfugMkqXgOhlvTMhCCQl6t36oJ-NOUuS0Xz6G6xNqo,16115
99
99
  reflex/components/datadisplay/__init__.py,sha256=L8pWWKNHWdUD2fbZRoEKjd_8c_hpDdGYO463hwkoIi4,438
100
100
  reflex/components/datadisplay/__init__.pyi,sha256=rYMwO_X4NvUex6IL2MMTnhdFRp8Lz5zweMwXaW_l7nc,588
@@ -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=p3BU476paTJEmCpL0IKniH6eR6VCc7ue8S_cDrmYrKY,8760
162
+ reflex/components/plotly/plotly.py,sha256=TAjHwZaZsYQC1bvbF4vq23AMFtFxudx6mnEC8DO4058,8715
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=zzsyo668aRZUX8aAKmf_cSfMlVD97frco4-HkmpL1yI,3182
312
- reflex/components/recharts/recharts.pyi,sha256=vPy4O4kAWG8hGrvqI6nKcr22L5OEDMb3P4zcSOnAVj4,7144
311
+ reflex/components/recharts/recharts.py,sha256=r3Fry0eE7vgonOvlOG-FrRlqDtyjowoyXG7rN5iZdHA,3595
312
+ reflex/components/recharts/recharts.pyi,sha256=xwD-dYxpf4Jw8-F2JIFoCpjr8J4LVS6e2YkRKeRB_i0,7178
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=ejJKZDYscjCYL1lMIPmPCbvqd5Gosw4FwbRsupyEIm4,21868
359
+ reflex/reflex.py,sha256=mTfc1GpG8QxpctjCwvkr5xuUsfXWIsRZwjiYUKb-t3Y,21896
360
360
  reflex/route.py,sha256=WZS7stKgO94nekFFYHaOqNgN3zZGpJb3YpGF4ViTHmw,4198
361
- reflex/state.py,sha256=qFeY7g8SUovb3V-QNcoWS47eG4S4Y4_WV8gFb6rrJBI,134231
361
+ reflex/state.py,sha256=PR7ACv96OfssFazmMsKoQe5XMP7Cu8a2i1MuL-oJH6M,133929
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.6.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
392
- reflex-0.6.6.dist-info/METADATA,sha256=ySim6FrzBDp9kwlgn4Wal-MC5fIMCwxYIDPwA3xecYQ,12099
393
- reflex-0.6.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
394
- reflex-0.6.6.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
395
- reflex-0.6.6.dist-info/RECORD,,
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,,