Add Trash UI for restoring and purging soft-deleted snips#23
Merged
Conversation
Soft-deleted snips (IsTrash) previously vanished from every view with no way to recover or permanently remove them. Add a "Trash" pane-footer entry that lists trashed snips across all CLIs, each with Restore (clears the trash flag, returning the snip to its CLI) and Delete permanently (removes it from the store after confirmation). Trash actions don't add or remove a CLI, so they persist and rebuild the Trash list in place via SaveAndRefreshTrashAsync rather than the full SaveAndRefreshAsync — keeping the user on the Trash view. The CLI switcher and tag list refresh lazily on next CLI selection, which already reads the updated document. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SaveAndRefreshTrashAsync persisted the document and rebuilt the Trash list but left the pane tag list for the currently-selected CLI stale: a restore could surface a tag no visible snip had, and a purge could orphan one, with the stale list staying on screen until the user switched CLIs and back. Rebuild the tags in place (suppressing the content swap a tag change would trigger) so the pane stays accurate while the user remains on the Trash view. Found by codex review. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Implements the Trash UI carried-over item from
TODO.md. Soft-deleted snips (IsTrash) previously vanished from every view with no way to recover or permanently remove them — soft-delete was effectively a one-way trapdoor. This adds the missing recovery surface.Changes
TrashViewModel(Core) — a cross-CLI list of trashed snips, reusingSnipCardViewModelfor visual consistency. ExposesSnips,HasSnips,IsEmpty.ShellViewModelgains:OpenTrash()— builds and shows the trash view from the in-memory document (mirrorsOpenSettings).RestoreSnipCommand— clearsIsTrash, returning the snip to its CLI.DeleteForeverCommand— permanently removes the snip after a confirmation dialog.SaveAndRefreshTrashAsync— a lighter refresh that persists and rebuilds the trash list in place, keeping the user on the Trash view. Trash actions never add/remove a CLI, so the switcher and tag list are left to refresh lazily on the next CLI selection (they already read from the updated document).TrashContentTemplatewith per-snip Restore / Delete-permanently actions, and aTrashViewModelcase inShellContentTemplateSelector.[Unreleased].Notes
DeleteCurrentCliAsyncbehaviour), so a trashed snip always still has a live parent CLI.chore/todo, alongside the existing Delete-CLI danger-styling note.Tests
OpenTrashlists only trashed snips; Restore clears the flag, saves, and drops it from the view; Delete-permanently only removes when confirmed).🤖 Generated with Claude Code