Hello, everyone!
I’m currently working on a Streamlit app and struggling to optimize a button. It’s an Add/Remove action button. When pressed, it triggers the app to rerun three times instead of once, resulting in the text below moving up and down, creating a laggy appearance. Is there any way to make this smoother? Thanks!
if commodity_id in favorites:
fav_button = st.button('❌Remove from Favorites', type='secondary', use_container_width=True)
if fav_button:
callbacks.on_remove_from_favorites(cookie_manager, commodity_id, favorites)
else:
fav_button = st.button('➕Add to Favorites', type='primary', use_container_width=True)
if fav_button:
callbacks.on_add_to_favorites(cookie_manager, commodity_id, favorites)

streamlit==1.30.0
python==3.11.7
localhost