Skip to content

Commit

Permalink
Clear usage of cacheTime in queries
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Mar 8, 2024
1 parent cac4db8 commit b81651a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 64 deletions.
11 changes: 1 addition & 10 deletions src/app/pages/ConsensusAccountDetailsPage/Staking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,7 @@ const StakingContent: FC<StakingContentProps> = ({ address }) => {
const offset = (pagination.selectedPage - 1) * PAGE_SIZE
const scope = useRequiredScopeParam()
const { network } = scope
const delegationsQuery = useGetConsensusAccountsAddressDelegations(
network,
address,
{},
{
query: {
cacheTime: 0,
},
},
)
const delegationsQuery = useGetConsensusAccountsAddressDelegations(network, address)
const { isLoading, isFetched, data } = delegationsQuery
if (isFetched && offset && !delegationsQuery.data?.data?.delegations?.length) {
throw AppErrors.PageDoesNotExist
Expand Down
16 changes: 4 additions & 12 deletions src/app/pages/ConsensusAccountsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,10 @@ export const ConsensusAccountsPage: FC = () => {
}
}, [isMobile, setTableView])

const accountsQuery = useGetConsensusAccounts(
network,
{
limit: tableView === TableLayout.Vertical ? offset + PAGE_SIZE : PAGE_SIZE,
offset: tableView === TableLayout.Vertical ? 0 : offset,
},
{
query: {
cacheTime: 0,
},
},
)
const accountsQuery = useGetConsensusAccounts(network, {
limit: tableView === TableLayout.Vertical ? offset + PAGE_SIZE : PAGE_SIZE,
offset: tableView === TableLayout.Vertical ? 0 : offset,
})
const { isLoading, isFetched, data } = accountsQuery
const accountsData = data?.data
if (isFetched && offset && !accountsData?.accounts?.length) {
Expand Down
10 changes: 1 addition & 9 deletions src/app/pages/ConsensusDashboardPage/SnapshotValidators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,7 @@ export const SnapshotValidators: FC<{ scope: SearchScope }> = ({ scope }) => {
const { t } = useTranslation()
const { network } = scope

const validatorsQuery = useGetConsensusValidators(
network,
{ limit: API_MAX_TOTAL_COUNT },
{
query: {
cacheTime: 0,
},
},
)
const validatorsQuery = useGetConsensusValidators(network, { limit: API_MAX_TOTAL_COUNT })
const validators = validatorsQuery.data?.data.validators

return (
Expand Down
10 changes: 1 addition & 9 deletions src/app/pages/ConsensusDashboardPage/Validators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@ export const ValidatorsCard: FC<{ scope: SearchScope }> = ({ scope }) => {
const { t } = useTranslation()
const { network } = scope

const validatorsQuery = useGetConsensusValidators(
network,
{ limit },
{
query: {
cacheTime: 0,
},
},
)
const validatorsQuery = useGetConsensusValidators(network, { limit })
const validators = validatorsQuery.data?.data

return (
Expand Down
16 changes: 4 additions & 12 deletions src/app/pages/ProposalsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,10 @@ export const ProposalsPage: FC = () => {
}
}, [isMobile, setTableView])

const proposalsQuery = useGetConsensusProposals(
network,
{
limit: tableView === TableLayout.Vertical ? offset + PAGE_SIZE : PAGE_SIZE,
offset: tableView === TableLayout.Vertical ? 0 : offset,
},
{
query: {
cacheTime: 0,
},
},
)
const proposalsQuery = useGetConsensusProposals(network, {
limit: tableView === TableLayout.Vertical ? offset + PAGE_SIZE : PAGE_SIZE,
offset: tableView === TableLayout.Vertical ? 0 : offset,
})
const { isLoading, isFetched, data } = proposalsQuery
const proposalsData = data?.data
if (isFetched && offset && !proposalsData?.proposals?.length) {
Expand Down
16 changes: 4 additions & 12 deletions src/app/pages/ValidatorsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,10 @@ export const ValidatorsPage: FC = () => {
}
}, [isMobile, setTableView])

const validatorsQuery = useGetConsensusValidators(
network,
{
limit: tableView === TableLayout.Vertical ? offset + PAGE_SIZE : PAGE_SIZE,
offset: tableView === TableLayout.Vertical ? 0 : offset,
},
{
query: {
cacheTime: 0,
},
},
)
const validatorsQuery = useGetConsensusValidators(network, {
limit: tableView === TableLayout.Vertical ? offset + PAGE_SIZE : PAGE_SIZE,
offset: tableView === TableLayout.Vertical ? 0 : offset,
})
const { isLoading, isFetched, data } = validatorsQuery
const validatorsData = data?.data
if (isFetched && offset && !validatorsData?.validators?.length) {
Expand Down

0 comments on commit b81651a

Please sign in to comment.