Closed steveluscher closed 1 year ago
Root cause: you can't start activities while not in the foreground. Back to back calls must wait for the originating activity to return to the RESUMED
state. This should be elevated to an immediate exception, to catch the programming error.
What if, instead, localAssociateAndExecute
just didn't resolve until the app returns to the foreground?
I guess maybe there are cases where you don't intend to fire off another localAssociateAndExecute
but you might like to make use of the result in the background.
What about the opposite? Any call to localAssociateAndExecute
suspends until the app is foregrounded before starting the activity?
What about the opposite? Any call to localAssociateAndExecute suspends until the app is foregrounded before starting the activity?
Yeah, this should be doable. I'll make sure there's a sensible timeout option, in case the app fails to be foregrounded in a timely manner (say, 2 mins).
Problem
Naturally, the correct thing to do when you have multiple operations to perform with a wallet is to:
Despite this, we know that people – for one reason or another – are going to write apps that execute that full loop multiple times, with one call coming on the heels of the next.
I discovered a bug with doing so when testing the React Native SDK. I called two
@solana/wallet-adapter
methods in a row and observed the second one being silently dropped. This appears to be because, if we start an activity before the first one has fully animated back to the original app, that activity will be ignored.Repro
Make the following modification:
Open the fake dapp and click the ‘combined authorize and sign’ button.