-
Notifications
You must be signed in to change notification settings - Fork 318
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
π¦βπ₯ [FIX]: Refresh ledger sync QR code on expiration #7690
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ 5 Skipped Deployments
|
927ebdb
to
ae6dd17
Compare
At the end we have an error message? |
@mcayuelas-ledger the error message won't show even if you stayed several days on the QR code page. Every time the QR code expire a new WS connection will created and the QR code will be refreshed. But if the WS connection closes in less than 30 seconds something else is wrong so the "WS closed prematurely" error would be shown. I wanted to avoid to constantly refresh the WS connection when something actually is wrong with it (and also potentially IP ban users). (In the screen recording I lowered the 30 seconds to 3). |
ae6dd17
to
4d375a7
Compare
} | ||
if (e instanceof NoTrustchainInitialized) { | ||
dispatch(setFlow({ flow: Flow.Synchronize, step: Step.UnbackedError })); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to add
setError(e); throw e;
also no? Like before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setError
is not needed because react-query manages the error (that's why I removed the useState
).
For the throw
I don't think it's needed either. From my understanding it was here to avoid the then
that follows. Or am I missing something ?
if (e instanceof NoTrustchainInitialized) { | ||
setCurrentStep(Steps.UnbackedError); | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
β Checklist
npx changeset
was attached.π Description
It retries the QR code processing flow when the WS closes unexpectedly. Since AFAIK there is no way to make sure the WS closed because of the QR code expiration: if the connection closes in less than 30 seconds the flow is not retried and the old error is shown. Here's a demo the behaviour with a min time 3 seconds:
Screen.Recording.2024-08-27.at.17.12.23.mov
I ended up using react query because I was getting some weird behaviour with the old logic. However I didn't manage to use the build in
retry
option because thedelay
option didn't work for me it kept on retrying after +30 seconds instead of immediatley π€·.β Context
π§ Checklist for the PR Reviewers