You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
960 B
Markdown
18 lines
960 B
Markdown
---
|
|
# 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`.
|