reflex 0.6.8a2__py3-none-any.whl → 0.6.8.post1__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.
reflex/state.py CHANGED
@@ -1384,6 +1384,29 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1384
1384
  for substate in self.substates.values():
1385
1385
  substate.reset()
1386
1386
 
1387
+ @classmethod
1388
+ @functools.lru_cache
1389
+ def _is_client_storage(cls, prop_name_or_field: str | ModelField) -> bool:
1390
+ """Check if the var is a client storage var.
1391
+
1392
+ Args:
1393
+ prop_name_or_field: The name of the var or the field itself.
1394
+
1395
+ Returns:
1396
+ Whether the var is a client storage var.
1397
+ """
1398
+ if isinstance(prop_name_or_field, str):
1399
+ field = cls.get_fields().get(prop_name_or_field)
1400
+ else:
1401
+ field = prop_name_or_field
1402
+ return field is not None and (
1403
+ isinstance(field.default, ClientStorageBase)
1404
+ or (
1405
+ isinstance(field.type_, type)
1406
+ and issubclass(field.type_, ClientStorageBase)
1407
+ )
1408
+ )
1409
+
1387
1410
  def _reset_client_storage(self):
1388
1411
  """Reset client storage base vars to their default values."""
1389
1412
  # Client-side storage is reset during hydrate so that clearing cookies
@@ -1391,10 +1414,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1391
1414
  fields = self.get_fields()
1392
1415
  for prop_name in self.base_vars:
1393
1416
  field = fields[prop_name]
1394
- if isinstance(field.default, ClientStorageBase) or (
1395
- isinstance(field.type_, type)
1396
- and issubclass(field.type_, ClientStorageBase)
1397
- ):
1417
+ if self._is_client_storage(field):
1398
1418
  setattr(self, prop_name, copy.deepcopy(field.default))
1399
1419
 
1400
1420
  # Recursively reset the substate client storage.
@@ -2405,8 +2425,9 @@ class UpdateVarsInternalState(State):
2405
2425
  for var, value in vars.items():
2406
2426
  state_name, _, var_name = var.rpartition(".")
2407
2427
  var_state_cls = State.get_class_substate(state_name)
2408
- var_state = await self.get_state(var_state_cls)
2409
- setattr(var_state, var_name, value)
2428
+ if var_state_cls._is_client_storage(var_name):
2429
+ var_state = await self.get_state(var_state_cls)
2430
+ setattr(var_state, var_name, value)
2410
2431
 
2411
2432
 
2412
2433
  class OnLoadInternalState(State):
@@ -1,8 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: reflex
3
- Version: 0.6.8a2
3
+ Version: 0.6.8.post1
4
4
  Summary: Web apps in pure Python.
5
- Home-page: https://reflex.dev
6
5
  License: Apache-2.0
7
6
  Keywords: web,framework
8
7
  Author: Nikhil Rao
@@ -15,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
18
  Requires-Dist: alembic (>=1.11.1,<2.0)
19
19
  Requires-Dist: build (>=1.0.3,<2.0)
20
20
  Requires-Dist: charset-normalizer (>=3.3.2,<4.0)
@@ -47,6 +47,7 @@ Requires-Dist: wheel (>=0.42.0,<1.0)
47
47
  Requires-Dist: wrapt (>=1.11.0,<2.0) ; python_version < "3.11"
48
48
  Requires-Dist: wrapt (>=1.14.0,<2.0) ; python_version >= "3.11"
49
49
  Project-URL: Documentation, https://reflex.dev/docs/getting-started/introduction
50
+ Project-URL: Homepage, https://reflex.dev
50
51
  Project-URL: Repository, https://github.com/reflex-dev/reflex
51
52
  Description-Content-Type: text/markdown
52
53
 
@@ -359,7 +359,7 @@ reflex/model.py,sha256=u19v2w-1MAeru46Hht8UscisIq5Y5EMuNo9xVbXIXEg,17352
359
359
  reflex/page.py,sha256=2vnjP1SPRZY_l_E3uog0al3s2a_evzjCYUB4UTK8FNE,2388
360
360
  reflex/reflex.py,sha256=v2rdQHfKGQ9_klXEf96NbAEmeMV3SQaORl9v0RYGxWg,17000
361
361
  reflex/route.py,sha256=WZS7stKgO94nekFFYHaOqNgN3zZGpJb3YpGF4ViTHmw,4198
362
- reflex/state.py,sha256=s0f1fkBGVawbxXLdohNH-cu_YxN_7ZWYBKObhyZgseM,141647
362
+ reflex/state.py,sha256=giLPXW5LY8GB2XNXo-rNohoY2OrA6TMesuTqmPye5Rk,142326
363
363
  reflex/style.py,sha256=Djj6TUbDORun3nSwny6IQL8vYdlCON_b8qITkbSZ5Oc,12571
364
364
  reflex/testing.py,sha256=90KTRRI5dzww_wwMQshm-TisbnQjPfkMNGYkvqeaRS8,34795
365
365
  reflex/utils/__init__.py,sha256=y-AHKiRQAhk2oAkvn7W8cRVTZVK625ff8tTwvZtO7S4,24
@@ -390,8 +390,8 @@ reflex/vars/function.py,sha256=ZxeznTQqprp4ernr8ADk5B4ztbuwqTMGnHo9zVCHDpw,14583
390
390
  reflex/vars/number.py,sha256=3dsxSqZOxEc47Fx19YlQaD0jlqHEouxjI0z5Zx_y_7U,27484
391
391
  reflex/vars/object.py,sha256=_wQMRaJV9IqanKLNwOLw-OX0A0fju40w74QjEdpVnoY,14310
392
392
  reflex/vars/sequence.py,sha256=i3wMyAxe63fxkvIK9MSLHc772ACHJUpbWp9qRY-VBok,50829
393
- reflex-0.6.8a2.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
394
- reflex-0.6.8a2.dist-info/METADATA,sha256=PQrESKn56QZHwWOcPwtdjS70E6gPz3FVVf6noYbwjAQ,12102
395
- reflex-0.6.8a2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
396
- reflex-0.6.8a2.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
397
- reflex-0.6.8a2.dist-info/RECORD,,
393
+ reflex-0.6.8.post1.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
394
+ reflex-0.6.8.post1.dist-info/METADATA,sha256=2O4RsT8X6g8U4VOrbKcXjqTXbY1srhpA3dI3Edn83aY,12169
395
+ reflex-0.6.8.post1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
396
+ reflex-0.6.8.post1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
397
+ reflex-0.6.8.post1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any