From d4d87a94f8786a4597af38aa8392525eb5c1f25e Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Thu, 13 Aug 2026 12:46:11 -0400 Subject: [PATCH] Avoid redundant render when setting spread before first display --- fixed-layout.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fixed-layout.js b/fixed-layout.js index 8ed7452..9c493bb 100644 --- a/fixed-layout.js +++ b/fixed-layout.js @@ -890,9 +890,10 @@ export class FixedLayout extends HTMLElement { #setSpread(value) { this.spread = value; - const currentSection = - this.book?.sections[this.index] ?? this.book?.sections[0]; + const started = this.#index >= 0; + const currentSection = started ? this.book?.sections[this.index] : null; this.#computeSpreads(); + if (!started) return; const resolved = currentSection ? this.getSpreadOf(currentSection) : null; if (resolved) this.goToSpread(resolved.index, resolved.side, "page"); else this.#render();