From cfc0bf0c81d8cae9144baac842c3331f77ceb918 Mon Sep 17 00:00:00 2001 From: Tim Bradgate Date: Fri, 8 May 2026 00:30:03 +0100 Subject: [PATCH 1/2] Fix save modal showing nonsensical 'page X of Y' when X > Y 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 --- .../show/config/script/ScriptEditor.vue | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/client/src/vue_components/show/config/script/ScriptEditor.vue b/client/src/vue_components/show/config/script/ScriptEditor.vue index 9eb7386f..50ac564f 100644 --- a/client/src/vue_components/show/config/script/ScriptEditor.vue +++ b/client/src/vue_components/show/config/script/ScriptEditor.vue @@ -712,18 +712,15 @@ export default { if (!this.IS_CUT_MODE) { if (this.scriptChanges) { this.savingInProgress = true; - this.totalSavePages = Object.keys(this.TMP_SCRIPT).length; + this.totalSavePages = this.currentMaxPage; this.curSavePage = 0; this.$bvModal.show('save-script'); - const orderedPages = Object.keys(this.TMP_SCRIPT) - .map((x) => parseInt(x, 10)) - .sort((a, b) => a - b); - - for (const pageNo of orderedPages) { + for (let pageNo = 1; pageNo <= this.currentMaxPage; pageNo++) { this.curSavePage = pageNo; - // Check whether the page actually has any lines on it, and if not then skip const tmpScriptPage = this.TMP_SCRIPT[pageNo.toString()]; + if (!tmpScriptPage) continue; + // Check whether the page actually has any lines on it, and if not then skip if (tmpScriptPage.length !== 0) { // Check the actual script to see if the page exists or not const actualScriptPage = this.GET_SCRIPT_PAGE(pageNo); From 1f5d562ff8cb7257e24e67908728d5781130a709 Mon Sep 17 00:00:00 2001 From: Tim Bradgate Date: Fri, 8 May 2026 00:52:41 +0100 Subject: [PATCH 2/2] Fix save modal page count using max of saved and unsaved pages 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 --- .../src/vue_components/show/config/script/ScriptEditor.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/vue_components/show/config/script/ScriptEditor.vue b/client/src/vue_components/show/config/script/ScriptEditor.vue index 50ac564f..6df5713d 100644 --- a/client/src/vue_components/show/config/script/ScriptEditor.vue +++ b/client/src/vue_components/show/config/script/ScriptEditor.vue @@ -712,11 +712,13 @@ export default { if (!this.IS_CUT_MODE) { if (this.scriptChanges) { this.savingInProgress = true; - this.totalSavePages = this.currentMaxPage; + const tmpPageKeys = Object.keys(this.TMP_SCRIPT).map((x) => Number.parseInt(x, 10)); + const maxPage = Math.max(this.currentMaxPage, ...tmpPageKeys, 0); + this.totalSavePages = maxPage; this.curSavePage = 0; this.$bvModal.show('save-script'); - for (let pageNo = 1; pageNo <= this.currentMaxPage; pageNo++) { + for (let pageNo = 1; pageNo <= maxPage; pageNo++) { this.curSavePage = pageNo; const tmpScriptPage = this.TMP_SCRIPT[pageNo.toString()]; if (!tmpScriptPage) continue;