Issue with Displaying Cached Results in Streamlit 1.24.0 Upgrade

I encountered a problem after upgrading from Streamlit 1.12.0 to 1.24.0 regarding the display of cached results. Whenever I press a button, the page quickly refreshes all components, which completes in less than half a second. The issue arises when using GridOptionBuilder with select boxes, as pressing a select box causes the visual to refresh and unselect the box. In the previous version (1.12.0), the visuals did not refresh, allowing me to press the select box without any problem.


@st.cache_data
def load_trades(environment):
    sql_string = config["ENVIRONMENTS"][environment]["trades_query"]
    with sql_config.get_connection() as conn:
        raw_trades = psql.read_sql_query(sql_string, conn, parse_dates=["DeliveryBeginCet", "DeliveryEndCet"])
    return raw_trades[COLUMNS]

trades = load_trades(environment=environment.lower())

gb = GridOptionsBuilder.from_dataframe(trades)
gb.configure_selection(selection_mode="multiple", use_checkbox=True)

grid_options = gb.build()
trades_selected = pd.DataFrame(AgGrid(trades,
    gridOptions=grid_options,
    enable_enterprise_modules=True,
    allow_unsafe_jscode=True,
    update_mode=GridUpdateMode.SELECTION_CHANGED,
    columns_auto_size_mode=ColumnsAutoSizeMode.FIT_ALL_COLUMNS_TO_VIEW)["selected_rows"])

@st.cache(allow_output_mutation=True, ttl=3600)
def load_trades(environment):
    sql_string = config["ENVIRONMENTS"][environment]["trades_query"]
    with sql_config.get_connection() as conn:
        raw_trades = psql.read_sql_query(sql_string, conn, parse_dates=["DeliveryBeginCet", "DeliveryEndCet"])
    return raw_trades[COLUMNS]
1 Like

Hi @andreaswendelbo, and welcome to our forum!

Do you have a link to the app and its code, please, so we can diagnose further?

Thanks,
Charly

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