mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 02:34:21 +00:00
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:
@@ -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'}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user