deephaven / streamlit-deephaven

Deephaven Streamlit custom component
MIT License
1 stars 3 forks source link

fix: Streamlit fixes #14

Closed jnumainville closed 3 months ago

jnumainville commented 3 months ago

Fixes #7 Moved most code to streamlit_deephaven.py and removed DEV_MODE since running test.py directly is no more difficult.

Fixes #8 Fixed through moving server start code to a cache resource to ensure it is only ran once.

Fixes #9 Added _remove_widgets(), which is called every time the server reruns.

Fixes #10 Added a random nonce. I'm not sure if it really matters but I used a completely random one rather than the id of the widget as the id of the widget is the memory address in CPython.

jnumainville commented 3 months ago

@mofojed I still have one more issue as mentioned but I'm not sure what's wrong. If it's easier we can get this review done and I can create a new issue.

Sometimes, when the streamlit tab opens after running streamlit run streamlit_deephaven/test_app.py an error appears in streamlit because the object is not found. It's not appearing in the panels list either. It seems to happen more if I have lots of tabs open but I am not 100% sure as it happens consistently but I don't have a deterministic recreation.

Screenshot 2024-05-28 at 9 33 41 AM Screenshot 2024-05-28 at 9 33 50 AM

So, something is going wrong such that a table added to __main__.__dict__ is not grabbed by the server.