Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Duplicate transactions with transactionStatuses #1200

Open
VadimSaveljev opened this issue Jul 18, 2023 · 1 comment
Open

Duplicate transactions with transactionStatuses #1200

VadimSaveljev opened this issue Jul 18, 2023 · 1 comment
Labels
bug Something is broken

Comments

@VadimSaveljev
Copy link
Contributor

VadimSaveljev commented Jul 18, 2023

'sent' is an ExtrinsicStatusRune here

sent.transactionStatuses((status) => {
  if (status === 'ready') {
    setStatus(...);
  }

  return false;
}).run();
            
const inBlockEvents = await sent.inBlockEvents().run();

So this code breaks if I cancel the transaction, even though it's in a try catch block
The initial fix was to add await
await sent.transactionStatuses
but then it will be stuck forever, unless I add return true

   if (status === 'ready') {
    setStatus(...);
    
    return true;
  }

unfortunately this creates a new issue, now the first transaction will be called twice in a row
I receive a popup two times, after confirming the second one, only then it proceeds further

@VadimSaveljev VadimSaveljev added the bug Something is broken label Jul 18, 2023
@VadimSaveljev
Copy link
Contributor Author

VadimSaveljev commented Jul 18, 2023

the only way to mitigate this for now is to use the initial code without await or return true and add .rehandle(is(SignerError), (error) => error.access('inner')) after .transactionStatuses
At least this way my catch captures the error and the whole page doesn't turn red

though I thought error.access('inner') would return specifically that portion of the error object
instead I get this
Screenshot 2023-07-18 at 20 35 51

maybe this #1176 will help me later

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something is broken
Projects
Status: No status
Development

No branches or pull requests

1 participant