-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Creating custom components inside a callback does not work correctly #5634
Comments
The current behaviour is pretty much how I would expect the callbacks to work. To my best knowledge the callback is executed before the run. So when the callback triggers the line is added to the screen. Then the entire script is re-run. Then of course the line is gone, given the piece of code with the extra line is never executed during the re-run. So really the way to do this is to have a placeholder string outside of the callback, which will be filled in the callback.
|
Hello again. Here is a similar and likely related issue: aghasemi/streamlit_js_eval#2 I'm not much informed about the internals of Streamlit, so cannot dig very deep... |
I still dont think it is a bug, but exactly how a callback should work. |
If you watch this https://docs.streamlit.io/library/advanced-features/session-state So any widget you place within the callback will be visible for a brief second, while the callback is executed. Then, when the main run happens it will be removed again, as it is not part of the re-run. The callbacks pretty much just exist to to update the session state before the script is executed. I hope this helps. |
Hello, Sorry for being late. The problem is that this issue actually happens when you call SJE inside any branch, e.g. an |
Hi. This may be of interest: aghasemi/streamlit_js_eval#2 See the last message. |
Checklist
Summary
Hi,
Is it possible to create a custom component inside a callback? I see some weird behaviour with my streamlit_js_eval component which happens only when using callbacks. Can you help please or confirm it doesn't work at all?
Reproducible Code Example
Steps To Reproduce
Expected Behavior
A line of text is written.
Current Behavior
A line of text is written but then immediately removed.
Is this a regression?
Debug info
Additional Information
No response
Are you willing to submit a PR?
Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.
If you'd like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.
The text was updated successfully, but these errors were encountered: