fix(ui): close picker on empty items#345
Merged
sudo-tee merged 1 commit intosudo-tee:mainfrom Mar 31, 2026
Merged
Conversation
b56f6ed to
001e969
Compare
Owner
|
Thanks for the PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<C-d>delete in the session picker) results in an empty item list, the picker now closes automatically instead of staying open in an invalid empty state.closefunction toPickerOptionsthat each backend sets with its own cleanup logic, and checks for empty results in all reload handlers.Problem
Deleting the last session with
<C-d>left the picker open with no items. There was no handling for the empty-list case after a reload action resolved, so the picker would refresh with zero entries.With an empty picker, no recovery was possible either -- all action handlers in every backend (Telescope, fzf-lua, mini.pick, Snacks) guard execution on having a currently selected item, so
<C-s>(new session) would silently do nothing. The user's only option was to dismiss the broken picker and reopen it.Approach
Each picker backend now provides an
opts.close()implementation using its native close mechanism:actions.close()withselection_madeguardfzf-lua.winwith aclosedflag to prevent double-callback fromdefault/eschandlersmini_pick.stop(), with callback handled naturally byon_done_picker:close()withselection_madeguardAll reload handlers check
#resolved_items == 0and callopts.close()instead of refreshing.