Skip to content

Commit 16e50fc

Browse files
fix refresh (#265)
1 parent af5fb41 commit 16e50fc

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

app/callbacks/data_callbacks.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,25 @@ def api_watcher(
328328
logger.info("Skipping update: no significant change detected")
329329
return dash.no_update
330330

331-
return api_sequences.to_json(orient="split"), event_id_table.to_json(orient="split")
331+
# Compare new and old event_id_table before returning
332+
new_event_id_table_json = (
333+
event_id_table.to_json(orient="split")
334+
if not event_id_table.empty
335+
else pd.DataFrame().to_json(orient="split")
336+
)
337+
338+
print(event_id_table)
339+
340+
old_event_id_table_json = (
341+
local_event_id_table.to_json(orient="split") if not local_event_id_table.empty else None
342+
)
343+
344+
if new_event_id_table_json == old_event_id_table_json:
345+
# Only api_sequences changed, keep event_id_table untouched
346+
return api_sequences.to_json(orient="split"), dash.no_update
347+
else:
348+
# Both changed, update both
349+
return api_sequences.to_json(orient="split"), new_event_id_table_json
332350

333351
except Exception as e:
334352
logger.error(f"Failed to fetch sequences: {e}")

0 commit comments

Comments
 (0)