Avoid redundant render when setting spread before first display

This commit is contained in:
john-okeefe committed 2026-08-13 12:46:11 -04:00
1 parent eb9ae699d7
commit d4d87a94f8
1 file changed
+3 -2
+3 -2
View File
@@ -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();