chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.3.1 Latest 5 packages
iOS: a list read again keeps each item's like and reveal with it
OpenThis replaces .onAppear with .onChange(of: key, initial: true) in ActionButton, Clamped, ResolvedRichBlocks, DetailsBlock and ResolvedContentWarning. A row that stays on screen when a list is read again now re-reads its state from the view's memory for the new key. initial: true keeps the first-draw behaviour .onAppear gave. The warning's key moves to a computed property so the modifier can use it, and the Group wrapper lets onChange apply in both the revealed and hidden branches.
I found nothing wrong. Two caveats:
- I didn't build or run it, and the author says it wasn't reproduced on a simulator.
- No test covers it, as the body already says. Please do the manual check the body lists: like a gallery, let newer ones come in, refresh, and confirm the heart stays on that gallery.
This swaps .onAppear for .onChange(of: key, initial: true) in ActionButton, Clamped, ResolvedRichBlocks, DetailsBlock and ResolvedContentWarning. A row that stays on screen when a list is read again now reloads its remembered state when its key changes, so it no longer shows the previous item's like or reveal. For ResolvedContentWarning the key becomes a property, so onChange can use it. I couldn't build it or see the checks, so I haven't verified it compiles.
initial: true keeps the first-appearance behaviour. The keys are the item-derived ones that view.memory already used, and hashValue is stable within a process, so the lookups match.
One small gap: onAppear also re-ran when a still-live view reappeared. onChange runs only on a key change. Memory is keyed by item, so I don't expect this to matter.
The pull has no test, as its body says. Its manual check, liking a gallery, letting newer ones come in, refreshing and seeing the heart stay on it, is still worth doing on a device.
1 approval
2 passed, 5 skipped
On iOS, a gallery liked in a Grain feed could show unliked after the feed was read again (pulled to refresh, or "newer" tapped on coming back), while another gallery showed liked. The like was saved; the row kept the state of the item that held its place before. A revealed content warning could carry over the same way, onto another item's labelled pictures.
Claude Opus 5.5 · high
What changes
Likes and other actions follow their own item when a list is read again: a gallery you favorited shows its heart filled and its count right wherever it moves to.
Content warnings, "more" on clamped text, and details blocks do the same: one revealed or opened stays with its item, and the item that takes its place starts hidden or closed as its own state says.
Why
ListLayoutidentifies its rows by place (ForEach(0..<count, id: \.self)), andActionButton,ResolvedContentWarning,Clamped,ResolvedRichBlocksandDetailsBlockread their state from the view's memory (or the data, an Action'sexisting) only.onAppear. When a refresh moves items, a row on screen keeps its view and its@State, andonAppeardoes not run again, so it draws the previous item's state. Each now reads it again whenever its key changes,.onChange(of: key, initial: true), as the web renderer'sAction.sveltederives it by key. Keying the rows by item instead was not taken: list items carry no identity of their own, and a row's state is what its key says either way.The server's data was right: all 30 of the reporter's latest
social.grain.favoriterecords are in Grain's index (social.grain.gallery.getFavoriteslists them on each gallery), and grain-serve refuses a bad service token rather than answering withoutviewer.fav.How it was checked
just ios-test: the app builds and HUDKit's 48 tests pass. Not reproduced on a simulator; the rest is left to CI.Shortcomings
No test holds it: HUDKit's tests host no SwiftUI views. Not tried by hand: like a gallery, let newer ones come, refresh, and the heart should stay on it.