Fix backup import from file#3491
Open
martinsbruveris wants to merge 1 commit into
Open
Conversation
The "Import from file" button in the Automatic Backup Saves modal was broken in two independent ways: 1. UI: the button never opened a file picker. The invisible `.c-file-import` input is `position: absolute` and relies on a `position: relative` wrapper (`.c-file-import-button`) to be anchored over the button, exactly as the working import in OptionsSavingTab.vue does. The backup modal's PrimaryButton omitted that class, so the invisible input was positioned elsewhere and clicks on the button never reached it (and the `<label for="file">` has no matching element). Add `c-file-import-button` to anchor the input over the button. 2. Logic: importBackupsFromFile wrote the per-slot times to `this.backupTimeData`, a property that exists nowhere else; the field read by the modal, resetBackupTimer(), and the backup logic is `this.lastBackupTimes`. The imported backups were persisted to localStorage but the in-memory state/UI never refreshed until a reload. Write to `this.lastBackupTimes` instead. 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.
I came across a bug with in the Backup Saves modal. Basically, the "Import Saves" button was not working. I asked Claude to diagnose the issue, and Claude found to problems: first, there was a CSS issue that led to the file selection window not being opened; and there was a second independent issue, that led to game state not being updated, even after the file was loaded.
The fix is simple and I verified locally that it works.
For reference, below is the analysis done by Claude: The "Import from file" button in the Automatic Backup Saves modal was broken in two independent ways:
UI: the button never opened a file picker. The invisible
.c-file-importinput isposition: absoluteand relies on aposition: relativewrapper (.c-file-import-button) to be anchored over the button, exactly as the working import in OptionsSavingTab.vue does. The backup modal's PrimaryButton omitted that class, so the invisible input was positioned elsewhere and clicks on the button never reached it (and the<label for="file">has no matching element). Addc-file-import-buttonto anchor the input over the button.Logic: importBackupsFromFile wrote the per-slot times to
this.backupTimeData, a property that exists nowhere else; the field read by the modal, resetBackupTimer(), and the backup logic isthis.lastBackupTimes. The imported backups were persisted to localStorage but the in-memory state/UI never refreshed until a reload. Write tothis.lastBackupTimesinstead.