Is it possible to know which element/component triggered a rerun

Hi @jay -

Setting --global.logLevel=debug when you start your app will let you know what object changed and what message it sent, though using descriptive values for the key parameter of each widget makes it easier to tell. See the following gif and code

import streamlit as st

b1 = st.sidebar.button("A", key="button1")
b2 = st.sidebar.button("B", key="button2")

In the gif, each time I hit on of the buttons, you see a JSON/python dict returned, showing “id” having button1-- or button2 in the id field. The trigger_value field tells you what value was returned; in this case because they are buttons, it’s returning true when its clicked.

2 Likes