e2d468b77d
LIBRARY drew the strip from the catalogue and the catalogue from a `getAll` of the `photos` store: every row and every thumbnail in it, read back on a clock to learn what a scan of its own had just stored. On a catalogue of 150,000 frames one read measured 2036ms and sixty megabytes of rows; under a scan in the same window, with four lanes of RAW bytes and a LibRaw of a quarter of a gigabyte beside it, that read is the read that gives way — and a read that gave way answered `[]`, so the screen threw away the frames it was showing. That is the strip that loses its count and its thumbnails under a scan, and the frames the reader cannot pick while the roll is being read. The reading now hands its frames over as it stores them. `scanFolder` keeps the rows it met for the first time in the batch they landed in, and `flush` gives them to `watchRows` the moment the transaction closes; the screen appends them, so the strip is the roll arriving and not the roll found again. A batch is fifty frames, so this is fifty rows over a callback where it used to be a hundred and fifty thousand rows over IndexedDB. A frame the catalogue already held is not handed over — it is on the strip already, and it takes its place again when the reading is through. Which is why the read on the clock is now done for none of them. It stands for the reading another window holds, whose frames never come through this one: a reading of this window's hands over every frame it stores, and the counter that says so is what decides. The scan's own tail read went with it — the screen watching a reading reads the catalogue back once the reading ends, and that is the whole catalogue read once per scan instead of twice at the end of every one. `readPhotos` answers null where `listPhotos` answered an empty list. A read that came back with nothing is a read that failed, not a catalogue that emptied, and the frames it would have cleared are the frames the reader is working their way through. The strip keeps them. And the strip starts on what the last screen read. STUDIO and LIBRARY are two screens of one page, not two pages: the reader who goes to develop a frame and comes back was reading a hundred thousand rows again to see the strip they had just left. The folder is walked on the way in only when the last reading of it never finished. A reading that reaches its end clears its position, so "is there a position" is "was this roll cut off", answered by one small file opened and shut. Before this, every visit to the library paid a walk of the folder the reader was opening — a hundred thousand names off the disk, on the folder they had just asked to browse — and the reader who came to choose a frame paid for a scan they never asked for. A folder the reader wants looked at again says so itself, from the menu on its row. Checked on the running bundle: a 3000-frame scan reads the catalogue back twice, one of the two the screen coming up on a catalogue that is still empty — against three for the commit before this one and thirteen for the one before that, and nothing read back for the whole of the scan. The peak heap is 116-138MB with no long tasks, and 3001 rows went in. A reading stopped at 59 of 4000 still leaves `walk/ROLL.json` at 113,626 characters with no local storage key beside it, and the visit after a reload carries on with the strip filling under it — 162 rows, 312, 463, 612, 762, 913, 1062, 1212 as the scan went on. LIBRARY on 150,000 frames shows no "No folder yet" at any point and settles on "150000 photos" in 4.9s against the 8.1s it took. The wall, the strip, the grid, the deep link and the phone's recipes all pass their checks.