Skip to content

Commit

Permalink
Add a global reference to the Streamlit library (#230)
Browse files Browse the repository at this point in the history
I noticed the Streamlit.setComponentValue() example
was no longer working. For some reason, in the latest
releases the Streamlit library is no longer in the
global namespace. This change adds it back to the
window namespace, so JsCode callbacks in Folium can
return values to Streamlit.

Co-authored-by: Zachary Blackwood <[email protected]>
  • Loading branch information
hansthen and blackary authored Oct 14, 2024
1 parent 6793a64 commit b094a9e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions streamlit_folium/frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ declare global {
drawnItems: any
feature_group: any
layer_control: any
Streamlit: any
}
}

Expand Down Expand Up @@ -204,6 +205,7 @@ function getPixelatedStyles(pixelated: boolean) {
`
return styles
}
window.Streamlit = Streamlit;

window.initComponent = (map: any, return_on_hover: boolean) => {
const global_data = window.__GLOBAL_DATA__
Expand Down

0 comments on commit b094a9e

Please sign in to comment.