Skip to content

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

Merged
merged 13 commits into from
Jul 15, 2025
Merged

Groupless tests fixes #1422

merged 13 commits into from
Jul 15, 2025

Conversation

Copy link

changeset-bot bot commented Jul 10, 2025

🦋 Changeset detected

Latest commit: e4e4cdb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@alephium/mobile-wallet Patch
alephium-desktop-wallet Patch

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

@nop33 nop33 requested a review from mvaivre July 10, 2025 12:03
@nop33 nop33 added 📱 MW Mobile wallet 🖥 DW Desktop wallet labels Jul 10, 2025
@nop33 nop33 marked this pull request as ready for review July 10, 2025 12:03
}, minDurationMsRef.current || 300)

return () => clearTimeout(timeout)
}
}, [bg, blur, isActive, minDurationMs, progress, text])

if (!config.isActive) return null
Copy link
Member Author

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
Copy link
Member Author

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

@nop33 nop33 force-pushed the groupless-tests-fixes branch from 295831d to 559f3a3 Compare July 10, 2025 15:34
@nop33 nop33 force-pushed the chained-txs-extended branch from c969c36 to 7fda9b4 Compare July 11, 2025 10:11
@nop33 nop33 force-pushed the groupless-tests-fixes branch from cd0b5ed to e7059aa Compare July 11, 2025 10:46
Copy link
Member

@mvaivre mvaivre left a 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 }],
Copy link
Member

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)?

Copy link
Member Author

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.

Comment on lines 4 to 10
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'] })
}
Copy link
Member

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}`] });
  }
}

Copy link
Member Author

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.

Base automatically changed from chained-txs-extended to groupless July 11, 2025 11:49
@nop33 nop33 force-pushed the groupless-tests-fixes branch from e7059aa to 36ee201 Compare July 11, 2025 11:50
@nop33 nop33 force-pushed the groupless-tests-fixes branch from 3117388 to e4e4cdb Compare July 11, 2025 14:45
@nop33 nop33 merged commit a955e33 into groupless Jul 15, 2025
3 of 5 checks passed
@nop33 nop33 deleted the groupless-tests-fixes branch July 15, 2025 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖥 DW Desktop wallet 📱 MW Mobile wallet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants