-
Notifications
You must be signed in to change notification settings - Fork 17
Groupless tests fixes #1422
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
Groupless tests fixes #1422
Conversation
🦋 Changeset detectedLatest commit: e4e4cdb The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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 |
}, minDurationMsRef.current || 300) | ||
|
||
return () => clearTimeout(timeout) | ||
} | ||
}, [bg, blur, isActive, minDurationMs, progress, text]) | ||
|
||
if (!config.isActive) return null |
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.
This removal fixed the loading modal texts...
@@ -2,7 +2,7 @@ import { FIVE_MINUTES_MS, ONE_MINUTE_MS } from '@alephium/shared' | |||
import { QueryClient, QueryClientConfig } from '@tanstack/react-query' | |||
import { AxiosError } from 'axios' | |||
|
|||
const MAX_RETRIES = 3 | |||
const MAX_RETRIES = 10 |
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.
Since our API produces many 429's now, we want to avoid having incomplete data because all 3 retries have failed
295831d
to
559f3a3
Compare
c969c36
to
7fda9b4
Compare
cd0b5ed
to
e7059aa
Compare
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.
My main question is about those invalidation levels. I'm wondering about maintainability, how to know what is in each level?
@@ -105,7 +105,7 @@ export const addressTokensBalancesQuery = ({ addressHash, networkId, skip }: Add | |||
|
|||
export const addressBalancesQuery = ({ addressHash, networkId, skip }: AddressLatestTransactionQueryProps) => | |||
queryOptions({ | |||
queryKey: ['address', addressHash, 'balance', { networkId }], | |||
queryKey: ['address', addressHash, 'level:1', 'balances-all', { networkId }], |
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 may need some explanation regarding those keys.
Two questions popping in my mind:
- How are those "levels" defined?
- Why are we sometimes using camel case (
searchString
,tokensByType
), and other times dashes (balances-all
,tokens-search-strings
)?
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.
level:1 needs to be invalidated before level:2, because the queryFn of level:2 is calling queries that have level:1.
I did not find a better way to solve this. Using numbers creates some conceptual idea of dependency.
As for the camel case, I just didn't notice it. I'll fix that.
export const invalidateAddressQueries = async (address: string) => { | ||
await queryClient.invalidateQueries({ queryKey: ['address', address, 'level:0'] }) | ||
await queryClient.invalidateQueries({ queryKey: ['address', address, 'level:1'] }) | ||
await queryClient.invalidateQueries({ queryKey: ['address', address, 'level:2'] }) | ||
await queryClient.invalidateQueries({ queryKey: ['address', address, 'level:3'] }) | ||
await queryClient.invalidateQueries({ queryKey: ['address', address, 'level:4'] }) | ||
} |
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.
Could use a loop
export const invalidateAddressQueries = async (address: string) => {
for (let level = 0; level <= 4; level++) {
await queryClient.invalidateQueries({ queryKey: ['address', address, `level:${level}`] });
}
}
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.
This is actually intentional. I like being able to search the codebase using the queryKey to find its definition. I think it's fine to have 3 extra lines of code. It also makes the order of invalidation very explicit. I'd like to keep it if it's not a big problem for you.
Closes #1413
e7059aa
to
36ee201
Compare
3117388
to
e4e4cdb
Compare
Uh oh!
There was an error while loading. Please reload this page.