Popover process executing immediately

index_pt_col, dashboard_title, bell_noti = st.columns([1, 8, 1])
with bell_noti.popover("🔔"):
	tables_changes_text = process_noti_box()
	tables_changes_text = tables_changes_text.replace("\n", "  \n")
	st.write(tables_changes_text)

I’m having an issue with st.popover(). The process inside the popover logic is being executed immediately, but I need it to process only after clicking on the popover.

The application doesn’t know when the user clicks on a popover.

@Goyo Thanks for reply, Is it possible to do that, or is there another way?

@Gowtham As @Goyo stated the backend right now does not know anything about the UI-state. We have an open GitHub issue here: st.tabs: know and control state · Issue #6004 · streamlit/streamlit · GitHub and it would be best to upvote it to increase awareness of the demand :slightly_smiling_face: It already has quite some upvotes and it is on our radar to tackle, but work for it is not scheduled yet. But we will hopefully make this possible soon! See especially @Johannes’ update comment in the bottom of the thread.

Note that the GitHub issue is for tabs, but it is the same principle for popover, expander, etc. and I would assume that we update all of them when we start on the project.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.