Skip to content

feat: permanent snapshots#2382

Open
VictorVow wants to merge 5 commits into
mbnuqw:v5from
VictorVow:feat/permanent-snapshots
Open

feat: permanent snapshots#2382
VictorVow wants to merge 5 commits into
mbnuqw:v5from
VictorVow:feat/permanent-snapshots

Conversation

@VictorVow
Copy link
Copy Markdown
Contributor

@VictorVow VictorVow commented Mar 30, 2026

Summary

Adds the ability to mark snapshots as permanent, protecting them from automatic pruning by snapLimit, size, or age limits.

image

Behaviour

  • Adds a Make snapshot permanent button to the snapshot viewer header
  • Dedicated section for permanent snapshots separate from existing temporary snapshots
  • Permanent snapshots are never pruned by snapLimit, tab count, size, or age limits
  • Deleting a permanent snapshot requires a window.confirm() prompt
  • Permanent snapshots have an editable title field
  • Making a snapshot temporary clears any custom title and moves it back to the regular section
  • Button label swaps between "Make snapshot permanent" / "Make snapshot temporary" based on active snapshot state

Changes

  • src/types/snapshots.ts — added permanent?: boolean and title?: string to Snapshot interface
  • src/types/ipc.ts / src/bg/background.ts — registered makeSnapshotPermanent, makeSnapshotTemporary, renameSnapshot IPC actions
  • src/services/snapshots.bg.ts — implemented the three new actions; updated limitSnapshots to skip permanent snapshots when counting against limits
  • src/services/snapshots.fg.ts — added frontend IPC wrappers for the three new actions
  • src/page.setup/components/snapshots.vue — UI restructure: permanent/temporary sections, title input, make-permanent/temporary button, auto-focus behaviour, updateSnapshots reactivity fix
  • src/styles/page.setup/snapshots.styl — section headers, title input, permanent snapshot subtle background tint
  • src/_locales/dict.setup-page.ts — 5 new translation keys (en/ru)

Closes:

#161
#317
#456
#993

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
@VictorVow VictorVow changed the title feat(snapshots): permanent snapshots feat: permanent snapshots Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant