Skip to content

Commit

Permalink
Fix GH-22 (TypeError with Streamlit 0.84)
Browse files Browse the repository at this point in the history
In Streamlit 0.84, `component_value` is a `str` with JSON-encoded data,
rather than a `dict` as with previous Streamlit versions.

Added a check for `str` and if it's a `str`, we decode the JSON into a
`dict`.

Fixes: GH-22
  • Loading branch information
msabramo committed Jul 3, 2021
1 parent 3778b30 commit 18a0aff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions st_aggrid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ def cast_to_serializable(value):
raise(ex)

if component_value:
if isinstance(component_value, str):
component_value = simplejson.loads(component_value)
frame = pd.DataFrame(component_value["rowData"])
original_types = component_value["originalDtypes"]

Expand Down

0 comments on commit 18a0aff

Please sign in to comment.