reflex 0.7.3a2__py3-none-any.whl → 0.7.3.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
@@ -1396,6 +1396,29 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1396
1396
  for substate in self.substates.values():
1397
1397
  substate.reset()
1398
1398
 
1399
+ @classmethod
1400
+ @functools.lru_cache
1401
+ def _is_client_storage(cls, prop_name_or_field: str | ModelField) -> bool:
1402
+ """Check if the var is a client storage var.
1403
+
1404
+ Args:
1405
+ prop_name_or_field: The name of the var or the field itself.
1406
+
1407
+ Returns:
1408
+ Whether the var is a client storage var.
1409
+ """
1410
+ if isinstance(prop_name_or_field, str):
1411
+ field = cls.get_fields().get(prop_name_or_field)
1412
+ else:
1413
+ field = prop_name_or_field
1414
+ return field is not None and (
1415
+ isinstance(field.default, ClientStorageBase)
1416
+ or (
1417
+ isinstance(field.type_, type)
1418
+ and issubclass(field.type_, ClientStorageBase)
1419
+ )
1420
+ )
1421
+
1399
1422
  def _reset_client_storage(self):
1400
1423
  """Reset client storage base vars to their default values."""
1401
1424
  # Client-side storage is reset during hydrate so that clearing cookies
@@ -1403,10 +1426,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
1403
1426
  fields = self.get_fields()
1404
1427
  for prop_name in self.base_vars:
1405
1428
  field = fields[prop_name]
1406
- if isinstance(field.default, ClientStorageBase) or (
1407
- isinstance(field.type_, type)
1408
- and issubclass(field.type_, ClientStorageBase)
1409
- ):
1429
+ if self._is_client_storage(field):
1410
1430
  setattr(self, prop_name, copy.deepcopy(field.default))
1411
1431
 
1412
1432
  # Recursively reset the substate client storage.
@@ -2342,8 +2362,9 @@ class UpdateVarsInternalState(State):
2342
2362
  for var, value in vars.items():
2343
2363
  state_name, _, var_name = var.rpartition(".")
2344
2364
  var_state_cls = State.get_class_substate(state_name)
2345
- var_state = await self.get_state(var_state_cls)
2346
- setattr(var_state, var_name, value)
2365
+ if var_state_cls._is_client_storage(var_name):
2366
+ var_state = await self.get_state(var_state_cls)
2367
+ setattr(var_state, var_name, value)
2347
2368
 
2348
2369
 
2349
2370
  class OnLoadInternalState(State):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reflex
3
- Version: 0.7.3a2
3
+ Version: 0.7.3.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
@@ -13,7 +13,7 @@ reflex/page.py,sha256=qEt8n5EtawSywCzdsiaNQJWhC8ie-vg8ig0JGuVavPI,2386
13
13
  reflex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  reflex/reflex.py,sha256=gmYVXXASlx_4kpyYuqEASS2qNdG2lWbmVpNQ_LYeOJQ,20399
15
15
  reflex/route.py,sha256=nn_hJwtQdjiqH_dHXfqMGWKllnyPQZTSR-KWdHDhoOs,4210
16
- reflex/state.py,sha256=VmXm7SNuecE2y3sZo4yu-JW7frlb3Wi6V2o4A3it4eQ,141566
16
+ reflex/state.py,sha256=NZ7rnoWcUbGdOdTPIT2AVDl5cOGTZNWjzGlCCEELERA,142245
17
17
  reflex/style.py,sha256=dilXPn8de80NzsXT53GPJrmjELC5nPYIlCgongyq1zM,13145
18
18
  reflex/testing.py,sha256=c3boyBotUiDImK1lsO-Odeb4tgqRAvRdaT1lZ9QzPHg,35458
19
19
  reflex/.templates/apps/blank/assets/favicon.ico,sha256=baxxgDAQ2V4-G5Q4S2yK5uUJTUGkv-AOWBQ0xd6myUo,4286
@@ -398,8 +398,8 @@ reflex/vars/function.py,sha256=2sVnhgetPSwtor8VFtAiYJdzZ9IRNzAKdsUJG6dXQcE,14461
398
398
  reflex/vars/number.py,sha256=hacFEtv-63tMQN-oeVDWkrLFQL4utYG-b3ahYTb8b4M,29573
399
399
  reflex/vars/object.py,sha256=-fGqHThozjxAAuQL-wTwEItPiFI-ps53P2bKoSlW_As,17081
400
400
  reflex/vars/sequence.py,sha256=wxyiTV-_-N6FJNufIatubsnhEpXHFShcw3GEEEpYy3M,55893
401
- reflex-0.7.3a2.dist-info/METADATA,sha256=Jnwppkn5ZoQCXpqehgIsJXD8PyHro4LU_nxWDWeC3a4,12090
402
- reflex-0.7.3a2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
403
- reflex-0.7.3a2.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
404
- reflex-0.7.3a2.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
405
- reflex-0.7.3a2.dist-info/RECORD,,
401
+ reflex-0.7.3.post1.dist-info/METADATA,sha256=TcG6qRuzA6AtVxaMWAVuxXXuLW0vsyRJK4LksSAIYgY,12094
402
+ reflex-0.7.3.post1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
403
+ reflex-0.7.3.post1.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
404
+ reflex-0.7.3.post1.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
405
+ reflex-0.7.3.post1.dist-info/RECORD,,