Streamlit_elements callback onChange not working since 1.39.0

onChange event not working in streamlit-elements

Previously fixed with a patch on Issue #35 streamlit_elements for 1.34.0, working on 1.38.0

When updating to 1.39 or higher the onChange event doesnt work.

Fix on the same thread of issue says to replace:

 user_key = kwargs.get("user_key", None)

with

      try:
          user_key = None
          new_callback_data = kwargs[
              "ctx"
          ].session_state._state._new_session_state.get(
              "streamlit_elements.core.frame.elements_frame", None
          )
          if new_callback_data is not None:
              user_key = new_callback_data._key
      except:
          user_key = None

in “core/callback.py” but this doesn’t seem to fix the issue either

1 Like