Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REF: Use interaction manager for tx refresh #6463

Closed
wants to merge 1 commit into from
Closed

REF: Use interaction manager for tx refresh #6463

wants to merge 1 commit into from

Conversation

marcosrdz
Copy link
Member

InteractionManager helps minimizing UI hangs

@marcosrdz marcosrdz self-assigned this Apr 26, 2024
@GladosBlueWallet
Copy link
Collaborator

♫ This was a triumph. I'm making a note here: HUGE SUCCESS ♫

[android in browser] https://appetize.io/app/iu2zgnuq7mtmw2xn7s5b6i445y?device=pixel4

download apk

Comment on lines +114 to +116
BlueApp.fetchSenderPaymentCodes(lastSnappedTo),
fetchWalletBalances(lastSnappedTo),
fetchWalletTransactions(lastSnappedTo),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately, cant parallelize those 3, they have to be sequential.

  • fetch payment codes finds addresses from our payers
  • fetch balance finds all the used addresses AND fetches all balances for all addresses
  • finally, fetch txs gets all those addressesand fetches all their txs

if (showUpdateStatusIndicator) {
setWalletTransactionUpdateStatus(WalletTransactionsStatus.ALL);
const refreshAllWalletTransactions = async (lastSnappedTo?: number, showUpdateStatusIndicator: boolean = true): Promise<void> => {
await InteractionManager.runAfterInteractions(async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await is not needed, runAfterInteractions
Instead of using callback, I prefer Promise:

await new Promise((resolve) => {
  InteractionManager.runAfterInteractions(() => resolve(null));
});

@marcosrdz marcosrdz closed this May 26, 2024
@marcosrdz marcosrdz deleted the inte branch May 26, 2024 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants