Skip to content

Commit 86f9734

Browse files
authored
removing unneeded query and using same query on both screens (#3764)
1 parent 04084d0 commit 86f9734

File tree

5 files changed

+5
-40
lines changed

5 files changed

+5
-40
lines changed

packages/data-layer/src/data-layer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,6 @@ export class DataLayer {
945945
orderBy,
946946
filter,
947947
whitelistedPrograms,
948-
query = getRoundsQuery,
949948
}: {
950949
chainIds: number[];
951950
first: number;
@@ -955,7 +954,7 @@ export class DataLayer {
955954
whitelistedPrograms?: string[];
956955
query?: string | undefined;
957956
}): Promise<{ rounds: RoundGetRound[] }> {
958-
return await request(this.gsIndexerEndpoint, query, {
957+
return await request(this.gsIndexerEndpoint, getRoundsQuery, {
959958
orderBy: orderBy ?? "NATURAL",
960959
chainIds,
961960
first,

packages/data-layer/src/queries.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -605,35 +605,6 @@ export const getBlockNumberQuery = gql`
605605
`;
606606

607607
export const getRoundsQuery = gql`
608-
query GetRounds(
609-
$first: Int
610-
$orderBy: [RoundsOrderBy!]
611-
$filter: RoundFilter
612-
) {
613-
rounds(first: $first, orderBy: $orderBy, filter: $filter) {
614-
id
615-
chainId
616-
tags
617-
roundMetadata
618-
roundMetadataCid
619-
applicationsStartTime
620-
applicationsEndTime
621-
donationsStartTime
622-
donationsEndTime
623-
matchAmountInUsd
624-
matchAmount
625-
matchTokenAddress
626-
strategyId
627-
strategyName
628-
strategyAddress
629-
applications(first: 1000, filter: { status: { equalTo: APPROVED } }) {
630-
id
631-
}
632-
}
633-
}
634-
`;
635-
636-
export const getRoundsQueryWithAllApplications = gql`
637608
query GetRounds(
638609
$first: Int
639610
$orderBy: [RoundsOrderBy!]

packages/grant-explorer/src/features/api/rounds.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import { RoundGetRound, RoundsQueryVariables, useDataLayer } from "data-layer";
66
export const useRounds = (
77
variables: RoundsQueryVariables,
88
chainIds: number[],
9-
onlywWhitelistedPrograms = false,
10-
gqlQuery: string | undefined
9+
onlywWhitelistedPrograms = false
1110
): SWRResponse<RoundGetRound[]> => {
1211
const dataLayer = useDataLayer();
1312

@@ -27,7 +26,6 @@ export const useRounds = (
2726
first: 500,
2827
chainIds,
2928
whitelistedPrograms,
30-
query: gqlQuery,
3129
}),
3230
]);
3331

packages/grant-explorer/src/features/discovery/ExploreRoundsPage.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { getExplorerPageTitle } from "./utils/getExplorerPageTitle";
1111
import { RoundsGrid } from "./RoundsGrid";
1212
import { getEnabledChains } from "../../app/chainConfig";
1313
import { useMemo } from "react";
14-
import { getRoundsQueryWithAllApplications } from "data-layer/src/queries";
1514

1615
const ExploreRoundsPage = () => {
1716
const [params] = useSearchParams();
@@ -20,8 +19,7 @@ const ExploreRoundsPage = () => {
2019
const rounds = useFilterRounds(
2120
filter,
2221
getEnabledChains(),
23-
filter.status.includes("verified"),
24-
getRoundsQueryWithAllApplications
22+
filter.status.includes("verified")
2523
);
2624

2725
const publicRounds = useMemo(

packages/grant-explorer/src/features/discovery/hooks/useFilterRounds.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ export const ROUNDS_ENDING_SOON_FILTER: RoundSelectionParams & {
7575
export const useFilterRounds = (
7676
where: RoundSelectionParams,
7777
chains: TChain[],
78-
onlywWhitelistedPrograms?: boolean,
79-
gqlQuery?: string | undefined
78+
onlywWhitelistedPrograms?: boolean
8079
): SWRResponse<RoundGetRound[]> => {
8180
const chainIds =
8281
where.network === undefined || where.network.trim() === ""
@@ -104,7 +103,7 @@ export const useFilterRounds = (
104103
const orderBy =
105104
where.orderBy === undefined ? "CREATED_AT_BLOCK_DESC" : where.orderBy;
106105
const vars = { orderBy, filter };
107-
return useRounds(vars, chainIds, onlywWhitelistedPrograms, gqlQuery);
106+
return useRounds(vars, chainIds, onlywWhitelistedPrograms);
108107
};
109108

110109
const createRoundWhereFilter = (

0 commit comments

Comments
 (0)