New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add id to map api #7307
Add id to map api #7307
Conversation
lib/streamlit/elements/map.py
Outdated
deck_gl_json = to_deckgl_json( | ||
data, latitude, longitude, size, color, map_style, zoom | ||
) | ||
map_proto.json = deck_gl_json | ||
map_proto.use_container_width = use_container_width | ||
json_string = json.dumps(deck_gl_json) | ||
json_bytes = json_string.encode("utf-8") | ||
id = hashlib.md5(json_bytes).hexdigest() | ||
map_proto.id = id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to move this to a marshall
function, to mirror how the pydeck element does it.
lib/streamlit/elements/map.py
Outdated
map_proto.use_container_width = use_container_width | ||
json_string = json.dumps(deck_gl_json) | ||
json_bytes = json_string.encode("utf-8") | ||
id = hashlib.md5(json_bytes).hexdigest() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer the id
field be named something that doesn't make it seem like this is a widget, but the pydeck element already calls it id
, so changing it would be a big pain, and probably not worth it.
Describe your changes
GitHub Issue Link (if applicable)
Testing Plan
Screen.Recording.2023-09-11.at.9.58.26.AM.mov
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.