Uncheck dataframe row after closing dialog

I have a page with multiple dataframes and each dataframe allows users to select a row in the data, which will trigger a dialog window with some ways to interact with the data from the selected row.

The problem is that when users close the dialog window, the row will remain selected in the dataframe. If the user selects a row from a different dataframe, then they receive an error saying: “Only one dialog is allowed to be opened at the same time.”

Is there a way to un-select the row in the dataframe after the user closes their dialog window? Or is there a better way that I can handle this scenario without having to tell my users to just ignore the error message and manually un-select the data before selecting a different row.

Here is a code sample:

@st.dialog("Data Details1")
def data_details1(selection):
    tab1, tab2 = st.tabs(["Details", "Edit Data"])
    with tab1:
        st.write(selection)
    with tab2:
        st.write("Other stuff goes here")


@st.dialog("Data Details2")
def data_details2(selection):
    st.write("blah blah blah")
    st.write(selection)


data_select1 = st.dataframe(
    df1,
    on_select="rerun",
    selection_mode="single-row",
    key="data_table1",
)

# == Handle row selection from table ==
if data_select1.selection.rows:
    data_details1(data_select1.selection.rows)
    

data_select2 = st.dataframe(
    df2,
    on_select="rerun",
    selection_mode="single-row",
    key="data_table2",
)

# == Handle row selection from table ==
if data_select2.selection.rows:
    data_details2(data_select2.selection.rows)