fix(wallet): refetch balance and history on resume #164
No reviewers
Labels
No labels
app:activities
app:chat
app:chatelet
app:events
app:forum
app:libra
app:market
app:restaurant
app:tasks
app:wallet
app:webapp
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
aiolabs/webapp!164
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/wallet-resume-refetch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A payment that settled while the app was backgrounded stayed invisible until the user pressed Refresh by hand.
onPausecloses the socket to save battery, and the LNbits websocket only pushes on live events. It replays nothing on reconnect.onResumereconnected the socket and stopped there, so the notification for anything that settled in between reached no one, and both the balance and the transaction list sat at their pre-pause values.Fix
onResumenow pairs reconnection with an explicit refetch of both: the balance via PaymentService and the rows via WalletService. Neither implies the other, so both are needed.allSettledkeeps a failure in one from leaving the other un-refreshed.The balance fetch is extracted out of the polling fallback rather than duplicated, so the two paths cannot drift apart.
Verification
Ran a real internal payment against the live LNbits on this machine:
Worth recording: a first attempt reconnected immediately and did receive a message, which looked like a replay. It was a test artifact. LNbits dispatches the notification from an async task, and reconnecting within milliseconds meant the task found the new socket. The delay above is what a backgrounded app actually looks like, and with it the message is genuinely lost.
vue-tsc --noEmitis clean.