You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] [v0.0.7] resume_picker.rs set_filter(None) does not clear filter - selected_index not reset #196
Type: Logic bug - filter cannot be cleared once set
Version: v0.0.7
Issue Details
The set_filter() function has two bugs:
Bug 1: set_filter(None) doesn't clear the filter
/// Set filter text.pubfnset_filter(&mutself,filter:Option<String>){self.filter = filter;self.apply_filter();}/// Apply filter to sessions.fnapply_filter(&mutself){ifletSome(ref filter) = self.filter{// BUG: when filter is None, this branch is skipped// ... filtering logic}// No else clause to restore sessions when filter is None!}
When set_filter(None) is called, apply_filter() doesn't restore the sessions to the full unfiltered list because:
Line 39: if let Some(ref filter) = self.filter evaluates to false when filter is None
No else clause handles the None case to restore sessions
Expected behavior: Calling set_filter(None) should restore all sessions (show unfiltered list).
Bug 2: selected_index not reset after filtering
pubfnset_filter(&mutself,filter:Option<String>){self.filter = filter;self.apply_filter();// This modifies self.sessions but doesn't reset selected_index}
After apply_filter() reduces the number of sessions via self.sessions.retain(), the selected_index is not reset to 0. This can cause:
Out-of-bounds access when selected() returns None for filtered lists with fewer items than the old index
Incorrect session selection after filtering
Suggested Fix
For Bug 1 - Add else clause in apply_filter() to restore sessions:
fnapply_filter(&mutself){ifletSome(ref filter) = self.filter{// ... existing retain logic}else{// Reload all sessions from store when filter is cleared// Or track original sessions and restore them}}
For Bug 2 - Reset selected_index after filtering:
pubfnset_filter(&mutself,filter:Option<String>){self.filter = filter;self.apply_filter();self.selected_index = 0;// Reset selection after filter changes}
Activity