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

Potentially problematic release.


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

reflex/state.py CHANGED
@@ -1400,6 +1400,29 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1400
1400
  for substate in self.substates.values():
1401
1401
  substate.reset()
1402
1402
 
1403
+ @classmethod
1404
+ @functools.lru_cache
1405
+ def _is_client_storage(cls, prop_name_or_field: str | ModelField) -> bool:
1406
+ """Check if the var is a client storage var.
1407
+
1408
+ Args:
1409
+ prop_name_or_field: The name of the var or the field itself.
1410
+
1411
+ Returns:
1412
+ Whether the var is a client storage var.
1413
+ """
1414
+ if isinstance(prop_name_or_field, str):
1415
+ field = cls.get_fields().get(prop_name_or_field)
1416
+ else:
1417
+ field = prop_name_or_field
1418
+ return field is not None and (
1419
+ isinstance(field.default, ClientStorageBase)
1420
+ or (
1421
+ isinstance(field.type_, type)
1422
+ and issubclass(field.type_, ClientStorageBase)
1423
+ )
1424
+ )
1425
+
1403
1426
  def _reset_client_storage(self):
1404
1427
  """Reset client storage base vars to their default values."""
1405
1428
  # Client-side storage is reset during hydrate so that clearing cookies
@@ -1407,10 +1430,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1407
1430
  fields = self.get_fields()
1408
1431
  for prop_name in self.base_vars:
1409
1432
  field = fields[prop_name]
1410
- if isinstance(field.default, ClientStorageBase) or (
1411
- isinstance(field.type_, type)
1412
- and issubclass(field.type_, ClientStorageBase)
1413
- ):
1433
+ if self._is_client_storage(field):
1414
1434
  setattr(self, prop_name, copy.deepcopy(field.default))
1415
1435
 
1416
1436
  # Recursively reset the substate client storage.
@@ -2391,8 +2411,9 @@ class UpdateVarsInternalState(State):
2391
2411
  for var, value in vars.items():
2392
2412
  state_name, _, var_name = var.rpartition(".")
2393
2413
  var_state_cls = State.get_class_substate(state_name)
2394
- var_state = await self.get_state(var_state_cls)
2395
- setattr(var_state, var_name, value)
2414
+ if var_state_cls._is_client_storage(var_name):
2415
+ var_state = await self.get_state(var_state_cls)
2416
+ setattr(var_state, var_name, value)
2396
2417
 
2397
2418
 
2398
2419
  class OnLoadInternalState(State):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reflex
3
- Version: 0.7.10a1
3
+ Version: 0.7.10.post1
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
@@ -12,7 +12,7 @@ reflex/page.py,sha256=mqioadLDsABvfNqdLbxvUKqi1gulSKddMihZe3pjtdc,2678
12
12
  reflex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  reflex/reflex.py,sha256=MnqTPqgq3lkd5McHvpo-NeGM3uHIaGkLUclOZ3RNlFU,21017
14
14
  reflex/route.py,sha256=nn_hJwtQdjiqH_dHXfqMGWKllnyPQZTSR-KWdHDhoOs,4210
15
- reflex/state.py,sha256=ik3yezBR6vomaIdpFZClXy4w6CVdU3dR39IQDdahSTA,89423
15
+ reflex/state.py,sha256=irvpKSSmf4euTDFpQthU2Lj7sl053sA26M0KxtCynNw,90102
16
16
  reflex/style.py,sha256=8ciwcReoKSrPSwoteXJwv7YTK514tf7jrJ5RfqztmvA,13186
17
17
  reflex/testing.py,sha256=sCvxy7GjXB40dWZ_BbcXxrQvFXnRlS6VyWPVkU7j7JU,36297
18
18
  reflex/.templates/apps/blank/assets/favicon.ico,sha256=baxxgDAQ2V4-G5Q4S2yK5uUJTUGkv-AOWBQ0xd6myUo,4286
@@ -398,8 +398,8 @@ reflex/vars/function.py,sha256=0i-VkxHkDJmZtfQUwUfaF0rlS6WM8azjwQ8k7rEOkyk,13944
398
398
  reflex/vars/number.py,sha256=DlN9qx-kuGVq6Iiy3wxaKUxQ-HJ-CgdWpgoCpsKPefc,28174
399
399
  reflex/vars/object.py,sha256=P_BBOxP4Z53IiHPVx5-P279lFEwdEIYLWcqO_h1UyLo,17134
400
400
  reflex/vars/sequence.py,sha256=cuvW7aKrM43WV4S8rJvZUL-PlMvlC4G0ZLK4j7xhkTI,55225
401
- reflex-0.7.10a1.dist-info/METADATA,sha256=d2dbmRvhVCdoF04n2bDTOifms9JRthOw6RLQ3FF7uJE,11729
402
- reflex-0.7.10a1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
403
- reflex-0.7.10a1.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
404
- reflex-0.7.10a1.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
405
- reflex-0.7.10a1.dist-info/RECORD,,
401
+ reflex-0.7.10.post1.dist-info/METADATA,sha256=OXNqRMj5pu9QZhoz8PvusqRoyGC3hjW9smDlQwkuTNA,11733
402
+ reflex-0.7.10.post1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
403
+ reflex-0.7.10.post1.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
404
+ reflex-0.7.10.post1.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
405
+ reflex-0.7.10.post1.dist-info/RECORD,,