From 2da0f315c62eac47424651c90899fe57f08b8966 Mon Sep 17 00:00:00 2001 From: adish-rmr Date: Sat, 14 Mar 2026 00:01:51 +0100 Subject: [PATCH] fix --- app.py | 5 +++-- functions.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index e05ba40..8c79c34 100644 --- a/app.py +++ b/app.py @@ -1,8 +1,9 @@ import re +import extra_streamlit_components as stx import streamlit as st -from functions import check_auth, do_logout, get_cookie_manager +from functions import check_auth, do_logout from functions_ui import search_cas_inci, search_cir, show_login_page # Configure page @@ -12,7 +13,7 @@ st.set_page_config( layout="wide" ) -get_cookie_manager() # deve essere renderizzato prima di check_auth +st.session_state["_cm"] = stx.CookieManager(key="pif_cookies") # una sola volta per rerun if not check_auth(): show_login_page() diff --git a/functions.py b/functions.py index 458f256..ad64e86 100644 --- a/functions.py +++ b/functions.py @@ -68,7 +68,8 @@ _COOKIE_MAX_AGE = 7 * 24 * 3600 # 7 giorni in secondi def get_cookie_manager() -> stx.CookieManager: - return stx.CookieManager(key="pif_cookies") + """Ritorna il CookieManager della sessione corrente (creato una volta sola per rerun in app.py).""" + return st.session_state.get("_cm") # ---------------------------------------------------------------------------