Summary
In tui/src/state/generation_browser.rs (lines 69-72), filter_generations() only updates filtered_generations when the search input is empty if the length differs from generations. If the content changes but the count stays the same (e.g., one generation directory removed and another added between load_generations() calls), filtered_generations retains stale data.
Current behavior
if self.search_input.is_empty() {
if self.filtered_generations.len() != self.generations.len() {
self.filtered_generations = self.generations.clone();
}
}
The inner if only checks length, not content. When count is unchanged but entries differ, the update is skipped.
Expected behavior
When search is empty, filtered_generations should always reflect the current generations list.
Suggested fix
Remove the length guard when search is empty:
if self.search_input.is_empty() {
self.filtered_generations = self.generations.clone();
}
Reproduction scenario
- Start TUI with N generation directories present.
- While TUI is running, delete one generation directory and create a new one (same total count).
- Trigger
load_generations() (e.g., refresh). generations is rebuilt correctly, but filtered_generations still shows the old list because the length hasn't changed.
Summary
In
tui/src/state/generation_browser.rs(lines 69-72),filter_generations()only updatesfiltered_generationswhen the search input is empty if the length differs fromgenerations. If the content changes but the count stays the same (e.g., one generation directory removed and another added betweenload_generations()calls),filtered_generationsretains stale data.Current behavior
The inner
ifonly checks length, not content. When count is unchanged but entries differ, the update is skipped.Expected behavior
When search is empty,
filtered_generationsshould always reflect the currentgenerationslist.Suggested fix
Remove the length guard when search is empty:
Reproduction scenario
load_generations()(e.g., refresh).generationsis rebuilt correctly, butfiltered_generationsstill shows the old list because the length hasn't changed.