Version history of src/lib/library/rows.ts

September 2026

A favorite is not a hackermusic thing to invent: Navidrome keeps one per-user `annotation` row and the Subsonic pair `star`/`unstar` writes it (`server/subsonic/media_annotation.go:76-133`, which resolves the id it is given to an artist, an album, a playlist or a song) while `getStarred` reads all three kinds back in one unbounded request (`album_lists.go:120-175` runs three unpaged `GetAll`s), so the app got a heart worn by the row, the key that flips it, and one read per connection rather than a feature of its own — and the server kept the veto, which is the part that decides what the rest of it means. The set lives in memory and is never persisted, and the reason is the only argument worth having: a cache beside the song index buys an instant first paint of the hearts and costs the one thing a heart is for, since a mark on a track somebody unfavorited on their phone yesterday is a claim about the server printed with the app's own authority, and one small request per session is what saying what it means costs. Optimism is the other half — a keypress paints a pixel and does not wait on a tailnet round trip, with the refusal taking the row back and keeping its own sentence for the toolbar, because "Subsonic error 50: not authorized" and "Failed to fetch" want different things from the reader — and the boot race needed saying once: the hydrate carries the favorites as they were when the server read them, so a toggle the server has since accepted is newer knowledge about the same id and is re-applied over the answer rather than losing to it, with each local decision stamped by the generation it was made under so a press that outlived its own connection switch cannot resurrect itself over the next server's snapshot as a favorite nobody confirmed there. The mark itself is a row class and `content`, deliberately neither a component nor an element: the row window is the hottest scope in the app and its budget is measured against mounting every row on screen at once, and a component reading the store — the shape `TrackCacheMark` uses — blew that budget on its first run (a scope, two memos and an effect per row), while a static element per row, with nothing reactive about it at all, cost about 2ms of the same window and a virtualized list pays that again on every scroll. It sits at the head of the row's name rather than after it because the name cell is `overflow: hidden` with an ellipsis, which is to say a trailing heart goes missing on exactly the long-titled rows that needed the room, and the box is a fixed width so a row gaining its first heart moves neither its title nor the column. What CSS cannot reach is the accessibility tree, so the key also says what it did in words on a toolbar line that `f`, a click in the bar and a refused copy all share — one line, because news that outlives the thing it reported on is furniture, and a toolbar that keeps it is a noticeboard. Two finds came out of writing the tests. `endpointUrl` built caller params with `searchParams.set` over an iterator that yields every occurrence, so the repeated `id` that `star` is read with (`Values.Strings` is `URL.Query()["id"]`, `utils/req/req.go:63-66`) collapsed to its last entry: a batch favorite would have asked the server to star one track, been told ok, and left the caller believing the rest — invisible by construction, which is what a param-shape test is for. And an artist header had no way to name itself, because `/api/song` carries `mf.ArtistID` on the *track* and never on a row for the artist, so `buildRows` aggregates it now under the same first-one-wins rule the album row already uses for its id, and a header without one says so on the line instead of favoriting something the reader did not point at. The bar's three names answer the complementary question — clicking the track, the record or the artist asks the list to put that thing under the cursor and in view, over a request line (`lib/locate.ts`) since the two components are siblings and only the list knows where a thing lives — and it moves the cursor rather than only the scroll, because "where is this" is asked so the keys carry on from the answer, while the transport keeps its own marker and moves nothing the reader is looking at; the grid folds back to the list to do it, the scroll is `keepInView` so a visible track does not make the list jump, a name the query has hidden is *reported* with the key that would clear it rather than chased, since the query is something the reader typed and a click that edited their search to make the answer findable destroys their work, and a name with no id behind it is drawn disabled because a control that cannot do its job is a lie about the interface. Twenty-nine tests: thirteen of the store (the optimistic window held open by a fake that answers star/unstar when a test says so rather than in a microtask, the veto, the generation guard, the two presses on one id where the last answer is the truth because the server's setters are not toggles), six of the client (the fallback walks only an unrouted endpoint, and a stale salt buys one request not two), two of the row aggregation, six of the list honouring a click — where one asserted the cursor had moved twice and was wrong about the harness, not the app: two keydowns in one task both read the index the first has not committed, exactly as `cursorAt`'s own comment warns, so a burst has to be flushed to be counted — and the boot's own zero-diagnostic test. The one failure in the run is `HOT_SCOPE_TIME` on the virtualized `<For>`, which straddles its 8ms budget on this box with this change stashed away as surely as with it.
2000.nyc
·