Skip to content

fix(chats): redraw payment previews when rates arrive - #1875

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/chat-list-rate-redraw
Oct 29, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
fix/chat-list-rate-redraw

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

A payment in the chat list could preview in the currency it was sent in (£5.00) instead of the viewer's (CAD) until the Chats tab was reopened a few times.

The preview converts with the rates held at the moment the row is mapped, and Fiat.forViewer returns the amount unconverted when the sent currency's rate is missing. VerifiedProtoManager.saveRates merges streamed batches, so the display currency's rate can land before the sent currency's. ChatsViewModel only re-mapped on observePreferredRate(), which emits when the display rate changes, so a GBP rate arriving after CAD never redrew the row. Reopening the tab re-mapped with the rates on hand by then, which is why it settled eventually. The chat bubble was already right: ViewerAmount collects both flows.

ChatsViewModel, ArchivedChatsViewModel and SearchViewModel now also re-map on observeRates(), paired with the preferred rate to stay within five typed flows. The Archived list observed neither before. The share, group invite and currency send pickers map summaries too but don't show the preview, so they're unchanged.

The lists now re-map on any rate update rather than only display-rate updates. The mapping runs on dispatchers.Default.

ChatsViewModelRatesTest starts with only the CAD rate and a 5 GBP payment, checks the preview reads £5.00, then adds GBP without changing CAD and checks it reads the CAD amount. It fails without the fix. ChatsViewModelArchiveTest stubs observeRates() so its combine still emits.

iOS builds the preview in the row body from its observable cached rates, so it redraws when any rate lands and needs no change.

A Cash preview restates the sent amount at the display currency's rate and the sent
currency's rate. The Chats list only re-mapped when the preferred rate changed, so a
sent-currency rate arriving after the display rate left the preview in the sent
currency until the tab was reopened. Archived chats and Search observed neither flow.
Re-map on the rates map as well.
@bmc08gt bmc08gt self-assigned this Oct 29, 2026
@github-actions github-actions Bot added the type: fix Bug fix label Oct 29, 2026
@bmc08gt
bmc08gt merged commit fcc6d79 into code/cash Oct 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant