feat: permanent snapshots#2382
Open
VictorVow wants to merge 5 commits into
Open
Conversation
Permanent snapshots are never pruned by the automatic snapshots limit.
Users can promote any snapshot to permanent and demote it back to
temporary at any time.
Changes:
- Add `permanent?: boolean` and `title?: string` fields to the Snapshot
type; these flow automatically through NormalizedSnapshot → SnapshotState
- Modify `limitSnapshots()` to skip permanent snapshots when counting
against the configured limit; normalises the first kept non-permanent
snapshot against the full pre-prune chain to keep Unchanged refs valid
- Add `makeSnapshotPermanent` (normalises the snapshot in-place so it is
self-contained, then normalises its successor), `makeSnapshotTemporary`,
and `renameSnapshot` to the background service, IPC types, background
action registry, and frontend IPC wrappers
- Snapshots viewer UI:
- Left pane shows a "Permanent Snapshots" section above the
Create/Import controls; each entry has an editable title input
- Header gains a "Make snapshot permanent" / "Make snapshot temporary"
toggle button left of the Export dropdown
- For permanent snapshots the header title becomes an editable input
- Deleting a permanent snapshot requires confirmation via window.confirm
- Add translation keys for the four new UI strings (en + ru)
- Add styles for the permanent section label and the editable title input
1. Left-pane title is now read-only; clicking a permanent snapshot in the left pane automatically focuses the right-pane title input with the cursor placed at the end, enabling immediate keyboard editing. Added titleInputRef and updated activateSnapshot() accordingly. 2. Added a "TEMPORARY SNAPSHOTS" section header above the Create/Import controls, mirroring the existing "PERMANENT SNAPSHOTS" header. Wrapped controls + temporary list in .temporary-snapshots-section. 3. Fixed button text not swapping after "Make snapshot permanent". updateSnapshots() was preserving the old SnapshotState reference, which still carried permanent=false. Removed that preservation so the freshly-parsed reference (with correct permanent value) is used. 4. makeSnapshotTemporary() now also deletes snapshot.title, so a custom title is cleared when a snapshot is demoted to temporary.
- Remove unnecessary re-normalization of next snapshot in makeSnapshotPermanent; the Unchanged chain through the now-self-contained snapshot remains valid - Check and log RemovingSnapshotResult.Err in doMakePermanent, doMakeTemporary, and onRenameSnapshot, consistent with removeSnapshot error handling - Lower permanent snapshot resting :before opacity from .12 to .07 so it stays below the .10 active-state threshold and avoids visual ambiguity
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
Adds the ability to mark snapshots as permanent, protecting them from automatic pruning by snapLimit, size, or age limits.
Behaviour
snapLimit, tab count, size, or age limitswindow.confirm()promptChanges
src/types/snapshots.ts— addedpermanent?: booleanandtitle?: stringtoSnapshotinterfacesrc/types/ipc.ts/src/bg/background.ts— registeredmakeSnapshotPermanent,makeSnapshotTemporary,renameSnapshotIPC actionssrc/services/snapshots.bg.ts— implemented the three new actions; updatedlimitSnapshotsto skip permanent snapshots when counting against limitssrc/services/snapshots.fg.ts— added frontend IPC wrappers for the three new actionssrc/page.setup/components/snapshots.vue— UI restructure: permanent/temporary sections, title input, make-permanent/temporary button, auto-focus behaviour,updateSnapshotsreactivity fixsrc/styles/page.setup/snapshots.styl— section headers, title input, permanent snapshot subtle background tintsrc/_locales/dict.setup-page.ts— 5 new translation keys (en/ru)Closes:
#161
#317
#456
#993