It seems that on_change has no effect with the new Streamlit version. Your onChangeTest function is not called!
Anyway st.session_state[âtesting123â] contains the right value. Why programming like you did?
May be Iâm wrong, but it seems to me that the âStreamlit philosophyâ is rather to avoid callbacks.
x = st.button(âŚ)
if x:
âŚ
Why in your case, you donât have:
x = sac.chip( ⌠,key = âxxxxâ, âŚ)
if st.session_state.xxxx == âgoogleâ:
âŚ
if st.session_state.xxxx == âappleâ:
âŚ
Insert a line âprint(âxxxxâ)â into your callback function and you will see that it is not called in this latest version of Streamlit! I took your code and did it!
You should also discuss with the author of the âsacâ package and ask for their opinion.
the internal package structure has changed due to a refactoring; if you change the import in the streamlit_callback.py to from streamlit.components.v1 import custom_component as _components, it should work again. If you are not the author of sac, this might be something to bring to them.
That being written, this is not an official API we are going to guarantee from Streamlit-side However, we will look into this more closely and try to come up with a clean API for the future so that this patch is not needed anymore. In the meantime, I hope this^ unblocks you (for now).
Hey, thanks for the fix. But there seems to be some inconsistency in the result. I implemented it in my app and other custom components I built and at times, it does not seem to work. I know it was a hacky workaround but would have been nice to have had it.