Skip to content

Autosave the library while the app is open - #997

Draft
vcccdells wants to merge 5 commits into
whyboris:mainfrom
vcccdells:pr/2-autosave
Draft

vcccdells wants to merge 5 commits into
whyboris:mainfrom
vcccdells:pr/2-autosave

Conversation

@vcccdells

Copy link
Copy Markdown

Branch: pr/2-autosave → main · builds on PR 1 (contains its commits until PR 1 is merged) · own changes: 3 files, +85

The hub was written only when the app closed, so a crash or power loss lost every rating, tag and favorite of
the session. Now:

  • the library is saved every minute when something changed, and whenever the window loses focus;
  • app settings are saved the same way when they changed;
  • the save on close is unchanged.

The main process checks the path is still the open hub, so a late autosave can never land in a hub opened
since. If a save fails (e.g. a network share went away) the changes stay marked unsaved, are retried, and a
snackbar says so once per session. Demo mode is never autosaved. Uses the safe, serialized writes from PR 1.

Testing: hard-killed the app after edits (changes kept); triggered autosave and close at the same moment
(no corruption, writes serialized).

🤖 Generated with Claude Code

vcccdells and others added 5 commits October 6, 2026 16:58
The "A JavaScript error occurred in the main process" dialog came from the
folder scan. A file that could not be opened for hashing, a file that was
gone by the time it was stat'ed, and ffprobe output that is not valid JSON
each threw inside a callback. They now reject instead, so the file is skipped
and picked up on a later scan, and a failed hash no longer keeps its
import-queue slot forever. File hashes are unchanged.

Hub writes go to a .tmp file that is renamed over the .vha2 (falling back to
writing in place if the rename is refused), and writes run one at a time.
Before, the old file was renamed to .bak first, so a failed or interrupted
write left no hub file at all. The .bak now keeps the hub as it was before
the session's first save.

Any other uncaught main-process error is logged to vha-errors.log in the
settings folder instead of being shown in a dialog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
electron-builder packs "**/*", so .angular/cache (close to 1 GB after a few
builds) and any earlier release folder ended up inside app.asar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GTK turns the '*' filter into '*.*', which hid /usr/bin/vlc; on Linux the
dialog now has no filter and opens in /usr/bin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
electron-builder cannot read a PNG frame from icons.icns on Linux ('Could
not extract a PNG frame from ICNS file') and the Linux build stops; the PNG
icon set in src/assets/icons/png works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hub was written only when the app closed, so a crash or power loss lost
every rating, tag and favorite of the session. The library is now saved
every minute when something changed, and whenever the window loses focus;
app settings are saved the same way when they changed. The save on close is
unchanged.

The main process checks that the hub is still the open one, so a late
autosave can never land in a hub opened since. If saving fails (e.g. a
network share went away) the changes stay marked as unsaved, are retried on
the next autosave, and a snackbar says so once per session. Demo mode is
never autosaved.

Builds on the safe hub writes (tmp file + rename, one write at a time).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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