// What the fan keeps of each database over a switch (lane stalepic, 15 Oct // 2026). A database switch rebuilds the window's whole stack on the database // (`RootView.stack`), and the fan's tile prints and page pictures would go // with it: the cards printed again card by card, the pages drawn again // before a turn could show them. // // So they are kept here, above the rebuild: the tiles' prints, which are the // same cards on every database, and one set of page pictures a database. The // shown database's fan keeps its pictures decoded within its reach; every // other database keeps its pictures only as compressed bytes. // // Nothing here covers a switch. A switch reads the new database's kept Home // before it turns (`DatabaseScene.show`, `HomeModel.prepare`), so the old // Home stands as itself until the new one stands whole — the snapshot of the // old Home and the chosen database's last page laid over the page area are // gone with the frames between that they hid (295 A, walker294). #if os(iOS) import SwiftUI import UIKit @MainActor @Observable final class StalePages { /// The fan's tile prints, over every switch: the cards are the same on /// every database (291 E), and the switch's new fan printed each one in /// sight again before it stood — ~0.25 s of caps and no cards on the /// real household (293 row 2, walker292). A print is of its tile as /// drawn (`FanPrints`), so a card another database draws differently is /// printed again. let prints = FanTilePrints() /// Each database's kept pictures, by database. @ObservationIgnored private var kept: [String: PagePictures] = [:] init() {} /// `database`'s pictures, kept over a switch; made by `make` the first /// time. Its fan is the one shown now: every other database keeps only /// its bytes. The switch forgets where its pages were left: each draws at /// rest, so no picture of a page left scrolled stands under it (292, /// walker291: Me's page stood ~70 pt down in the first frame after a /// switch to Tinmen). func pictures(of database: String, make: () -> PagePictures) -> PagePictures { let pictures = kept[database] ?? make() kept[database] = pictures pictures.dropScrolled() for (other, theirs) in kept where other != database { theirs.letDecodedGo() } return pictures } } #endif