From 91f4493bd41ca24848e0620008dcd821a14692b4 Mon Sep 17 00:00:00 2001 From: MateoLOSTANLEN Date: Fri, 26 Sep 2025 09:53:51 +0200 Subject: [PATCH] fix refresh --- app/callbacks/data_callbacks.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/callbacks/data_callbacks.py b/app/callbacks/data_callbacks.py index b5de5c7..c7f6b74 100644 --- a/app/callbacks/data_callbacks.py +++ b/app/callbacks/data_callbacks.py @@ -328,7 +328,25 @@ def api_watcher( logger.info("Skipping update: no significant change detected") return dash.no_update - return api_sequences.to_json(orient="split"), event_id_table.to_json(orient="split") + # Compare new and old event_id_table before returning + new_event_id_table_json = ( + event_id_table.to_json(orient="split") + if not event_id_table.empty + else pd.DataFrame().to_json(orient="split") + ) + + print(event_id_table) + + old_event_id_table_json = ( + local_event_id_table.to_json(orient="split") if not local_event_id_table.empty else None + ) + + if new_event_id_table_json == old_event_id_table_json: + # Only api_sequences changed, keep event_id_table untouched + return api_sequences.to_json(orient="split"), dash.no_update + else: + # Both changed, update both + return api_sequences.to_json(orient="split"), new_event_id_table_json except Exception as e: logger.error(f"Failed to fetch sequences: {e}")