mirror of
https://github.com/block/buzz.git
synced 2026-11-24 18:21:59 +00:00
Opening a Solo chat made the header's agent portrait flash away and come back. The header draws its portraits from the chat's member list. That list (`channelMembersProvider`) is auto-disposed when the page closes, so every open refetched it from the relay. Until the fetch landed, the Solo header fell back to the viewer alone, then swapped to the agent once the roster arrived. The header now watches `latestChannelMembersProvider`: the last roster loaded in this relay, account and channel scope (the existing `watchLatestChannelMembers` snapshot), or before any load, the channel list's member snapshot. The fresh fetch still runs and replaces it when it lands. ### Before / after Opening a Solo chat, slowed 4x and cropped to the header. https://github.com/user-attachments/assets/f42e500e-8b0c-446d-b47c-68b58e98d5d5 https://github.com/user-attachments/assets/b8e63e39-c6ee-4fd6-b195-6327b709b316 ### Validation - Added a step to `Solo and channel headers show bounded roster portraits`: with the roster fetch held pending, the first frame of a Solo chat shows the agent portrait. It fails on main (the header shows the viewer) and passes with the fix. - Full mobile suite and `flutter analyze` pass. One unrelated test (`message_skeleton_geometry_test.dart: image null matches preview at 320.0`) failed once in the full run and passes on its own. - iOS simulator (iPhone 17 Pro, debug build, internal community): opened and closed a Solo chat repeatedly from Messages, before and after. Before, the first frame shows the viewer's avatar; after, the agent's portrait from the first frame, with the rest of the open and back flow unchanged. ### Regressions None expected. The header shows a roster from the last load (or the channel list) for the moment before the fresh fetch lands, the same staleness the page's names and author visibility already accept through `watchLatestChannelMembers`. No extra relay reads; the snapshot is scoped to the relay, account and channel, so another community or account never sees it. buzz-review-completed Signed-off-by: Tom Brow <tomb@squareup.com> Co-authored-by: Tom Brow <tomb@squareup.com> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>