Skip to content

Commit

Permalink
add hint for VarData deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
benedikt-bartscher committed Mar 1, 2024
1 parent 6f3d582 commit 1934f57
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions reflex/vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ def _decode_var(value: str) -> tuple[VarData | None, str]:

def json_loads(s):
try:
# TODO: go one pydantic api level lower to load json directly into dict
return VarData.model_validate_json(s).model_dump()
except pydantic_core.ValidationError as e:
raise ValueError(f"Invalid VarData: {s}") from e
Expand Down

0 comments on commit 1934f57

Please sign in to comment.