fix(claudbg-gtu4): sync sessions to DB before querying message counts in TUI
TUI startup was querying message_count from the DB without first calling ensure_synced, so counts were always 0 if the user hadn't run sessions list or index previously. Now syncs each session before the SELECT query. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>main
parent
ddaa772da4
commit
878e79733f
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
# claudbg-gtu4
|
||||||
|
title: 'TUI: message count always 0 because TUI never syncs sessions to DB'
|
||||||
|
status: completed
|
||||||
|
type: bug
|
||||||
|
priority: normal
|
||||||
|
created_at: 2026-04-01T17:37:06Z
|
||||||
|
updated_at: 2026-04-01T17:38:26Z
|
||||||
|
---
|
||||||
|
|
||||||
|
The TUI startup queries message_count from the sessions DB table, but never calls ensure_synced first. If the user opens the TUI without having run sessions list or index previously, the DB is empty and all message counts show 0.
|
||||||
|
|
||||||
|
Fix: call ensure_synced for each session_ref inside the block_in_place block before the SELECT query in run_tui().
|
||||||
|
|
||||||
|
## Summary of Changes
|
||||||
|
|
||||||
|
In `src/tui/run.rs`: changed `session_refs.into_iter()` to `session_refs.iter()` so the vec is not consumed before DB sync. Added a loop inside the `block_in_place` block to call `ensure_synced` for each session before querying `message_count` from the DB. This ensures the DB is populated even if the user opens the TUI without having previously run `sessions list` or `index`.
|
||||||
Loading…
Reference in New Issue