reflex 0.7.2a2__py3-none-any.whl → 0.7.2.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/style.py +3 -3
- {reflex-0.7.2a2.dist-info → reflex-0.7.2.post1.dist-info}/METADATA +1 -1
- {reflex-0.7.2a2.dist-info → reflex-0.7.2.post1.dist-info}/RECORD +7 -7
- {reflex-0.7.2a2.dist-info → reflex-0.7.2.post1.dist-info}/WHEEL +1 -1
- {reflex-0.7.2a2.dist-info → reflex-0.7.2.post1.dist-info}/LICENSE +0 -0
- {reflex-0.7.2a2.dist-info → reflex-0.7.2.post1.dist-info}/entry_points.txt +0 -0
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
|
|
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
|
-
|
|
2346
|
-
|
|
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):
|
reflex/style.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any, Literal, Type
|
|
5
|
+
from typing import Any, Literal, Mapping, Type
|
|
6
6
|
|
|
7
7
|
from reflex import constants
|
|
8
8
|
from reflex.components.core.breakpoints import Breakpoints, breakpoints_values
|
|
@@ -10,7 +10,7 @@ from reflex.event import EventChain, EventHandler, EventSpec, run_script
|
|
|
10
10
|
from reflex.utils import format
|
|
11
11
|
from reflex.utils.exceptions import ReflexError
|
|
12
12
|
from reflex.utils.imports import ImportVar
|
|
13
|
-
from reflex.utils.types import
|
|
13
|
+
from reflex.utils.types import typehint_issubclass
|
|
14
14
|
from reflex.vars import VarData
|
|
15
15
|
from reflex.vars.base import LiteralVar, Var
|
|
16
16
|
from reflex.vars.function import FunctionVar
|
|
@@ -189,7 +189,7 @@ def convert(
|
|
|
189
189
|
or (isinstance(value, list) and all(not isinstance(v, dict) for v in value))
|
|
190
190
|
or (
|
|
191
191
|
isinstance(value, ObjectVar)
|
|
192
|
-
and not
|
|
192
|
+
and not typehint_issubclass(value._var_type, Mapping)
|
|
193
193
|
)
|
|
194
194
|
else (key,)
|
|
195
195
|
)
|
|
@@ -365,8 +365,8 @@ reflex/page.py,sha256=qEt8n5EtawSywCzdsiaNQJWhC8ie-vg8ig0JGuVavPI,2386
|
|
|
365
365
|
reflex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
366
366
|
reflex/reflex.py,sha256=idDTvinthj0VsTP_TS225Y4p9wBSTTeGllRbyqiEmYU,19325
|
|
367
367
|
reflex/route.py,sha256=nn_hJwtQdjiqH_dHXfqMGWKllnyPQZTSR-KWdHDhoOs,4210
|
|
368
|
-
reflex/state.py,sha256=
|
|
369
|
-
reflex/style.py,sha256=
|
|
368
|
+
reflex/state.py,sha256=HEvMOnqF6TVE7CGhVb6qW_wDNRMFxJ4j9Lhc1iSIp-c,142185
|
|
369
|
+
reflex/style.py,sha256=dilXPn8de80NzsXT53GPJrmjELC5nPYIlCgongyq1zM,13145
|
|
370
370
|
reflex/testing.py,sha256=wzqppu_-4e1QeFJ-vLVpW19egTGm-JpU_c7wUPiURlE,35693
|
|
371
371
|
reflex/utils/__init__.py,sha256=y-AHKiRQAhk2oAkvn7W8cRVTZVK625ff8tTwvZtO7S4,24
|
|
372
372
|
reflex/utils/build.py,sha256=gm_lRsOqKeRD5mBiRToJcT4Vt_ZQPzDuazGfvJlSeeQ,9024
|
|
@@ -398,8 +398,8 @@ reflex/vars/function.py,sha256=2sVnhgetPSwtor8VFtAiYJdzZ9IRNzAKdsUJG6dXQcE,14461
|
|
|
398
398
|
reflex/vars/number.py,sha256=RHY_KsUxliIgn7sptYPPyDubIfLkGYr0TZjX4PB_dgI,29334
|
|
399
399
|
reflex/vars/object.py,sha256=cHVXN7I1MNw32KfpYKcmgStNSD4BnF3Y2CjkPABmjeo,16233
|
|
400
400
|
reflex/vars/sequence.py,sha256=X4Gducv2u6fSEZm9uBlMr030bhDO0jUxnKkUXNg4Mwg,54878
|
|
401
|
-
reflex-0.7.
|
|
402
|
-
reflex-0.7.
|
|
403
|
-
reflex-0.7.
|
|
404
|
-
reflex-0.7.
|
|
405
|
-
reflex-0.7.
|
|
401
|
+
reflex-0.7.2.post1.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
|
|
402
|
+
reflex-0.7.2.post1.dist-info/METADATA,sha256=euNHR_k4oOMm6azQaPXKeU5RlVS-2hb-AyW4CzsqJOs,11879
|
|
403
|
+
reflex-0.7.2.post1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
404
|
+
reflex-0.7.2.post1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
|
|
405
|
+
reflex-0.7.2.post1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|