-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
area:frontendRelated to frontend aspectsRelated to frontend aspectsfeature:st.dialogRelated to `st.dialog`Related to `st.dialog`priority:P2Medium-high priority - fix within one monthMedium-high priority - fix within one monthstatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expected
Description
Checklist
- I have searched the existing issues for similar issues.
- I added a very descriptive title to this issue.
- I have provided sufficient information below to help reproduce this issue.
Summary
If you have two separate dialogs in your app, opening the first dialog, closing it, and then opening up the second dialog can lead to stale elements from the first dialog showing up in the second dialog. This only happens if the second dialog takes a while to load.
Screenshot.2025-03-25.at.19.33.48.mp4
Reproducible Code Example
import streamlit as st
import time
@st.dialog("Dialog 1")
def show_dialog_1():
st.write("Dialog 1 content")
st.text_input("Text input")
@st.dialog("Dialog 2")
def show_dialog_2():
time.sleep(3)
st.write("Dialog 2 content")
if st.button("Open dialog 1"):
show_dialog_1()
if st.button("Open dialog 2"):
show_dialog_2()Steps To Reproduce
- Open the first dialog
- Close it
- Open the second dialog
Expected Behavior
No content from show_dialog_1 shows up in show_dialog_2 since these are independent dialogs.
Current Behavior
See video.
Is this a regression?
- Yes, this used to work in a previous version.
Debug info
- Streamlit version: 1.44
- Python version:
- Operating System:
- Browser:
Additional Information
I think the cleanest solution might be to clear all elements from the dialog when it gets closed or opened.
github-actions, schancksb, mamiba, uJFalkez, nakajima8 and 11 more
Metadata
Metadata
Assignees
Labels
area:frontendRelated to frontend aspectsRelated to frontend aspectsfeature:st.dialogRelated to `st.dialog`Related to `st.dialog`priority:P2Medium-high priority - fix within one monthMedium-high priority - fix within one monthstatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expected