fix(studio): load a large book's photos a few at a time for the PDF export

Every printed photo got its src at once, off screen in the editor and again
in the print frame, so a journey with a few hundred photos asked for every
original in parallel and the browser failed with insufficient resources.

The print markup now holds the source back, and the print view hands it over
four at a time, retries a failed photo once, gives up on one that never
answers and shows the progress on the Save button.

Closes #3102
This commit is contained in:
Maurice
2026-11-16 10:30:32 +01:00
parent 24bc132476
commit aa8d041a33
6 changed files with 181 additions and 5 deletions
@@ -10,6 +10,18 @@
// here is exactly how #2183 happened: the renderer kept a three-font copy
// while the picker grew to seven, and everything else fell back to Poppins.
/**
* Where a printed photo keeps its source until the print view asks for it.
*
* A book's sheets are rendered in one go, and an `<img>` starts loading the
* moment it has a `src`. A journey of a few hundred photos asked the server for
* every original at once, twice (off screen in the editor, then in the print
* frame), and the browser gave up with "insufficient resources" (#3102). So the
* print markup carries the source here and `loadPrintImages` hands it over a
* few at a time.
*/
export const PRINT_SRC_ATTR = 'data-print-src'
export function photoSrc(photoId: number, big: boolean): string {
return `/api/photos/${photoId}/${big ? 'original' : 'thumbnail'}`
}