Fix save modal showing nonsensical 'Saving page X of Y' when X > Y#996
Merged
Conversation
The modal displayed the raw script page number as X and the count of pages in TMP_SCRIPT as Y, so editing a single page at a high page number (e.g. page 13) showed "Saving page 13 of 1". Fix by iterating 1..currentMaxPage so the progress reflects the full script length, skipping pages not loaded into TMP_SCRIPT transparently. This also avoids surfacing the implementation detail that only changed pages are saved. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
currentMaxPage alone missed newly added pages (page numbers above the last backend-saved page). Use Math.max(currentMaxPage, ...TMP_SCRIPT keys) so new pages are included in both the loop bound and the total shown to the user. Co-Authored-By: Claude Sonnet 4.6 <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.



Summary
totalSavePageswas set toObject.keys(TMP_SCRIPT).length(count of loaded pages) whilecurSavePagewas set to the actual page number — two different units in the same "X of Y" displayMath.max(currentMaxPage, ...TMP_SCRIPT keys)so both values share the same scale. Taking the max of both sources handles existing pages (viacurrentMaxPagefrom the backend) and newly added pages that haven't been saved yet (which live inTMP_SCRIPTabovecurrentMaxPage). Pages not loaded intoTMP_SCRIPTare skipped silently, hiding the implementation detail that only changed pages are actually savedTest plan
🤖 Generated with Claude Code