-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
refactor: token balance error handling #3096
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 3324bbc The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
apps/laboratory/tests/email.spec.ts
Outdated
@@ -100,9 +100,18 @@ emailTest('it should show names feature only for EVM networks', async ({ library | |||
emailTest('it should show loading on page refresh', async () => { | |||
await page.page.reload() | |||
await validator.expectConnectButtonLoading() | |||
await page.page.waitForTimeout(5000) |
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.
is this required?
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.
Yeah it'd need to finish loading before i can open the modal again
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.
But we don't know when the loading will finish right? Cannot be wait for an element to be visible instead?
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.
I think best way here is to add a validator.expectConnectButtonReady
or similar that does
const connectButton = this.page.getByTestId('connect-button')
await expect(connectButton).toContainText('Connect', {
timeout: MAX_WAIT
}))
```
That way you do not use arbitrary timeouts
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.
Good idea, let me add that 🙏
@@ -239,7 +248,10 @@ export const AccountController = { | |||
SwapController.setBalances(SwapApiUtil.mapBalancesToSwapTokens(response.balances)) | |||
} | |||
} catch (error) { | |||
SnackController.showError('Failed to fetch token balance') | |||
if (chainId && state.tokenFetchFailureChainIds) { | |||
state.tokenFetchFailureChainIds.add(chainId) |
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.
Are we not clearing this? What happens if there's a true flake in the request?
I think we should silently retry after some time
Description
Refactored token balance error message and ensured that token balances are only fetched again after 5 seconds if the token balance API fails.
Type of change
Showcase (Optional)
Checklist