reflex 0.7.0a5__py3-none-any.whl → 0.7.0.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 +27 -6
- {reflex-0.7.0a5.dist-info → reflex-0.7.0.post1.dist-info}/METADATA +1 -1
- {reflex-0.7.0a5.dist-info → reflex-0.7.0.post1.dist-info}/RECORD +6 -6
- {reflex-0.7.0a5.dist-info → reflex-0.7.0.post1.dist-info}/WHEEL +1 -1
- {reflex-0.7.0a5.dist-info → reflex-0.7.0.post1.dist-info}/LICENSE +0 -0
- {reflex-0.7.0a5.dist-info → reflex-0.7.0.post1.dist-info}/entry_points.txt +0 -0
reflex/state.py
CHANGED
|
@@ -1412,6 +1412,29 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|
|
1412
1412
|
for substate in self.substates.values():
|
|
1413
1413
|
substate.reset()
|
|
1414
1414
|
|
|
1415
|
+
@classmethod
|
|
1416
|
+
@functools.lru_cache
|
|
1417
|
+
def _is_client_storage(cls, prop_name_or_field: str | ModelField) -> bool:
|
|
1418
|
+
"""Check if the var is a client storage var.
|
|
1419
|
+
|
|
1420
|
+
Args:
|
|
1421
|
+
prop_name_or_field: The name of the var or the field itself.
|
|
1422
|
+
|
|
1423
|
+
Returns:
|
|
1424
|
+
Whether the var is a client storage var.
|
|
1425
|
+
"""
|
|
1426
|
+
if isinstance(prop_name_or_field, str):
|
|
1427
|
+
field = cls.get_fields().get(prop_name_or_field)
|
|
1428
|
+
else:
|
|
1429
|
+
field = prop_name_or_field
|
|
1430
|
+
return field is not None and (
|
|
1431
|
+
isinstance(field.default, ClientStorageBase)
|
|
1432
|
+
or (
|
|
1433
|
+
isinstance(field.type_, type)
|
|
1434
|
+
and issubclass(field.type_, ClientStorageBase)
|
|
1435
|
+
)
|
|
1436
|
+
)
|
|
1437
|
+
|
|
1415
1438
|
def _reset_client_storage(self):
|
|
1416
1439
|
"""Reset client storage base vars to their default values."""
|
|
1417
1440
|
# Client-side storage is reset during hydrate so that clearing cookies
|
|
@@ -1419,10 +1442,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|
|
1419
1442
|
fields = self.get_fields()
|
|
1420
1443
|
for prop_name in self.base_vars:
|
|
1421
1444
|
field = fields[prop_name]
|
|
1422
|
-
if
|
|
1423
|
-
isinstance(field.type_, type)
|
|
1424
|
-
and issubclass(field.type_, ClientStorageBase)
|
|
1425
|
-
):
|
|
1445
|
+
if self._is_client_storage(field):
|
|
1426
1446
|
setattr(self, prop_name, copy.deepcopy(field.default))
|
|
1427
1447
|
|
|
1428
1448
|
# Recursively reset the substate client storage.
|
|
@@ -2330,8 +2350,9 @@ class UpdateVarsInternalState(State):
|
|
|
2330
2350
|
for var, value in vars.items():
|
|
2331
2351
|
state_name, _, var_name = var.rpartition(".")
|
|
2332
2352
|
var_state_cls = State.get_class_substate(state_name)
|
|
2333
|
-
|
|
2334
|
-
|
|
2353
|
+
if var_state_cls._is_client_storage(var_name):
|
|
2354
|
+
var_state = await self.get_state(var_state_cls)
|
|
2355
|
+
setattr(var_state, var_name, value)
|
|
2335
2356
|
|
|
2336
2357
|
|
|
2337
2358
|
class OnLoadInternalState(State):
|
|
@@ -362,7 +362,7 @@ reflex/model.py,sha256=yOLkxNOgi3GY9mT2E-6rkK-uLv8Av-kYSJ7I19y9JzE,17559
|
|
|
362
362
|
reflex/page.py,sha256=lbI5Sd4RzZadPV6cYBSNRDIlNlRwEnOv1snF2RGKH04,2392
|
|
363
363
|
reflex/reflex.py,sha256=FBQYdPaONW3IhYBmNJ-3Etqf9tIV3x_qAwZ8qnvHJZo,19962
|
|
364
364
|
reflex/route.py,sha256=nn_hJwtQdjiqH_dHXfqMGWKllnyPQZTSR-KWdHDhoOs,4210
|
|
365
|
-
reflex/state.py,sha256=
|
|
365
|
+
reflex/state.py,sha256=kTHwIW3C9VwOpU-rd9AUmI4Vcokr50VwPXR7Cz61csA,140317
|
|
366
366
|
reflex/style.py,sha256=LXQjo6YhmdqUA59dV9OUxWuScyuYEqnE0rbWYkZ_ogI,13277
|
|
367
367
|
reflex/testing.py,sha256=iJ41rsJAzkS_poOw-ztlCGHbO2tEihBNRhoBhjKDTx4,35645
|
|
368
368
|
reflex/utils/__init__.py,sha256=y-AHKiRQAhk2oAkvn7W8cRVTZVK625ff8tTwvZtO7S4,24
|
|
@@ -394,8 +394,8 @@ reflex/vars/function.py,sha256=v2W5JHgCK9Afu2mobFeoj03G6tbih1Y-wM7LQBwA9vU,14777
|
|
|
394
394
|
reflex/vars/number.py,sha256=rVybcAoMOOFsWAbA_BZN3GVx9p4W_YPLHVYRCJqti04,27861
|
|
395
395
|
reflex/vars/object.py,sha256=jfvxtrklztDtbD2zgNVNCZZE6X6HQMB6yJHPhtb0hUo,15033
|
|
396
396
|
reflex/vars/sequence.py,sha256=GiSXbOIcoy7VSrecuBjbhg5G4QTjFV0Rcfn5T0EsecA,52032
|
|
397
|
-
reflex-0.7.
|
|
398
|
-
reflex-0.7.
|
|
399
|
-
reflex-0.7.
|
|
400
|
-
reflex-0.7.
|
|
401
|
-
reflex-0.7.
|
|
397
|
+
reflex-0.7.0.post1.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
|
|
398
|
+
reflex-0.7.0.post1.dist-info/METADATA,sha256=26BEbRRe-Q-HRxq_zLljriY2Z3ktcYRR-3kYCLv1Luc,12077
|
|
399
|
+
reflex-0.7.0.post1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
400
|
+
reflex-0.7.0.post1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
|
|
401
|
+
reflex-0.7.0.post1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|