Skip to content

Commit 94d23ec

Browse files
committed
fix: fix chainid bug in refetch
1 parent 9daf106 commit 94d23ec

23 files changed

+76
-6
lines changed

web-devtools/src/hooks/queries/useDisputeTemplateFromId.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { useGraphqlBatcher } from "context/GraphqlBatcher";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45
import { isUndefined } from "utils/isUndefined";
56

67
import { graphql } from "src/graphql-generated";
@@ -29,6 +30,7 @@ export const useDisputeTemplateFromId = (templateId?: string) => {
2930
await graphqlBatcher.fetch({
3031
id: crypto.randomUUID(),
3132
document: disputeTemplateQuery,
33+
chainId: DEFAULT_CHAIN,
3234
variables: { id: templateId?.toString() },
3335
isDisputeTemplate: true,
3436
}),

web/src/components/ErrorFallback.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const ErrorContainer = styled.div`
2828
flex-direction: column;
2929
justify-content: center;
3030
align-items: center;
31+
3132
${landscapeStyle(
3233
() => css`
3334
flex-direction: row;
@@ -42,6 +43,7 @@ const InfoWrapper = styled.div`
4243
gap: 32px;
4344
align-items: center;
4445
flex: 1;
46+
4547
${landscapeStyle(
4648
() => css`
4749
align-items: start;

web/src/hooks/queries/useAllCasesQuery.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { useGraphqlBatcher } from "context/GraphqlBatcher";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45

56
import { graphql } from "src/graphql";
67
import { AllCasesQuery } from "src/graphql/graphql";
@@ -21,6 +22,11 @@ export const useAllCasesQuery = () => {
2122
return useQuery({
2223
queryKey: [`allCasesQuery`],
2324
queryFn: async () =>
24-
await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: allCasesQuery, variables: {} }),
25+
await graphqlBatcher.fetch({
26+
id: crypto.randomUUID(),
27+
document: allCasesQuery,
28+
chainId: DEFAULT_CHAIN,
29+
variables: {},
30+
}),
2531
});
2632
};

web/src/hooks/queries/useCasesQuery.ts

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/react-query";
22
import { Address } from "viem";
33

44
import { useGraphqlBatcher } from "context/GraphqlBatcher";
5+
import { DEFAULT_CHAIN } from "consts/chains";
56
import { isUndefined } from "utils/index";
67

78
import { graphql } from "src/graphql";
@@ -77,6 +78,7 @@ export const useCasesQuery = (skip = 0, first = 3, where?: Dispute_Filter, sortO
7778
await graphqlBatcher.fetch({
7879
id: crypto.randomUUID(),
7980
document: isUndefined(where) ? casesQuery : casesQueryWhere,
81+
chainId: DEFAULT_CHAIN,
8082
variables: {
8183
first,
8284
skip,
@@ -98,6 +100,7 @@ export const useMyCasesQuery = (user?: Address, skip = 0, where?: Dispute_Filter
98100
await graphqlBatcher.fetch({
99101
id: crypto.randomUUID(),
100102
document: isUndefined(where) ? myCasesQuery : myCasesQueryWhere,
103+
chainId: DEFAULT_CHAIN,
101104
variables: {
102105
skip,
103106
id: user?.toLowerCase(),

web/src/hooks/queries/useClassicAppealQuery.ts

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/react-query";
22

33
import { REFETCH_INTERVAL } from "consts/index";
44
import { useGraphqlBatcher } from "context/GraphqlBatcher";
5+
import { DEFAULT_CHAIN } from "consts/chains";
56

67
import { graphql } from "src/graphql";
78
import { ClassicAppealQuery } from "src/graphql/graphql";
@@ -49,6 +50,7 @@ export const useClassicAppealQuery = (id?: string | number) => {
4950
? await graphqlBatcher.fetch({
5051
id: crypto.randomUUID(),
5152
document: classicAppealQuery,
53+
chainId: DEFAULT_CHAIN,
5254
variables: {
5355
disputeID: id?.toString(),
5456
orderBy: "timestamp",

web/src/hooks/queries/useCounter.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { useGraphqlBatcher } from "context/GraphqlBatcher";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45

56
import { graphql } from "src/graphql";
67
import { CounterQuery } from "src/graphql/graphql";
@@ -28,6 +29,12 @@ export const useCounterQuery = () => {
2829

2930
return useQuery<CounterQuery>({
3031
queryKey: [`useCounterQuery`],
31-
queryFn: async () => await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: counterQuery, variables: {} }),
32+
queryFn: async () =>
33+
await graphqlBatcher.fetch({
34+
id: crypto.randomUUID(),
35+
document: counterQuery,
36+
chainId: DEFAULT_CHAIN,
37+
variables: {},
38+
}),
3239
});
3340
};

web/src/hooks/queries/useCourtDetails.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { REFETCH_INTERVAL } from "consts/index";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45
import { useGraphqlBatcher } from "context/GraphqlBatcher";
56

67
import { graphql } from "src/graphql";
@@ -37,6 +38,11 @@ export const useCourtDetails = (id?: string) => {
3738
enabled: isEnabled,
3839
refetchInterval: REFETCH_INTERVAL,
3940
queryFn: async () =>
40-
await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: courtDetailsQuery, variables: { id } }),
41+
await graphqlBatcher.fetch({
42+
id: crypto.randomUUID(),
43+
document: courtDetailsQuery,
44+
chainId: DEFAULT_CHAIN,
45+
variables: { id },
46+
}),
4147
});
4248
};

web/src/hooks/queries/useCourtPolicyURI.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { useGraphqlBatcher } from "context/GraphqlBatcher";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45
import { isUndefined } from "utils/index";
56

67
import { graphql } from "src/graphql";
@@ -29,6 +30,7 @@ export const useCourtPolicyURI = (id?: string | number) => {
2930
? await graphqlBatcher.fetch({
3031
id: crypto.randomUUID(),
3132
document: courtPolicyURIQuery,
33+
chainId: DEFAULT_CHAIN,
3234
variables: { courtID: id.toString() },
3335
})
3436
: undefined,

web/src/hooks/queries/useCourtTree.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { useGraphqlBatcher } from "context/GraphqlBatcher";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45

56
import { graphql } from "src/graphql";
67
import { CourtTreeQuery } from "src/graphql/graphql";
@@ -40,7 +41,12 @@ export const useCourtTree = () => {
4041
return useQuery<CourtTreeQuery>({
4142
queryKey: ["courtTreeQuery"],
4243
queryFn: async () =>
43-
await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: courtTreeQuery, variables: {} }),
44+
await graphqlBatcher.fetch({
45+
id: crypto.randomUUID(),
46+
document: courtTreeQuery,
47+
chainId: DEFAULT_CHAIN,
48+
variables: {},
49+
}),
4450
});
4551
};
4652

web/src/hooks/queries/useDisputeDetailsQuery.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { REFETCH_INTERVAL } from "consts/index";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45
import { useGraphqlBatcher } from "context/GraphqlBatcher";
56

67
import { graphql } from "src/graphql";
@@ -50,6 +51,7 @@ export const useDisputeDetailsQuery = (id?: string | number) => {
5051
await graphqlBatcher.fetch({
5152
id: crypto.randomUUID(),
5253
document: disputeDetailsQuery,
54+
chainId: DEFAULT_CHAIN,
5355
variables: { disputeID: id?.toString() },
5456
}),
5557
});

web/src/hooks/queries/useDisputeMaintenanceQuery.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { useGraphqlBatcher } from "context/GraphqlBatcher";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45

56
import { graphql } from "src/graphql";
67
import { DisputeMaintenanceQuery } from "src/graphql/graphql";
@@ -44,6 +45,7 @@ const useDisputeMaintenanceQuery = (id?: string) => {
4445
await graphqlBatcher.fetch({
4546
id: crypto.randomUUID(),
4647
document: disputeMaintenance,
48+
chainId: DEFAULT_CHAIN,
4749
variables: { disputeId: id?.toString(), disputeIdAsString: id?.toString() },
4850
}),
4951
});

web/src/hooks/queries/useDisputeTemplateFromId.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { useGraphqlBatcher } from "context/GraphqlBatcher";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45
import { isUndefined } from "utils/index";
56

67
import { graphql } from "src/graphql";
@@ -29,6 +30,7 @@ export const useDisputeTemplateFromId = (templateId?: string) => {
2930
await graphqlBatcher.fetch({
3031
id: crypto.randomUUID(),
3132
document: disputeTemplateQuery,
33+
chainId: DEFAULT_CHAIN,
3234
variables: { id: templateId?.toString() },
3335
isDisputeTemplate: true,
3436
}),

web/src/hooks/queries/useDrawQuery.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { useGraphqlBatcher } from "context/GraphqlBatcher";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45

56
import { graphql } from "src/graphql";
67
import { DrawQuery } from "src/graphql/graphql";
@@ -31,6 +32,7 @@ export const useDrawQuery = (address?: string | null, disputeID?: string, roundI
3132
await graphqlBatcher.fetch({
3233
id: crypto.randomUUID(),
3334
document: drawQuery,
35+
chainId: DEFAULT_CHAIN,
3436
variables: { address, disputeID, roundID },
3537
}),
3638
});

web/src/hooks/queries/useEvidences.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { REFETCH_INTERVAL } from "consts/index";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45
import { useGraphqlBatcher } from "context/GraphqlBatcher";
56
import { transformSearch } from "utils/transformSearch";
67

@@ -56,6 +57,7 @@ export const useEvidences = (evidenceGroup?: string, keywords?: string) => {
5657
const result = await graphqlBatcher.fetch({
5758
id: crypto.randomUUID(),
5859
document: document,
60+
chainId: DEFAULT_CHAIN,
5961
variables: { evidenceGroupID: evidenceGroup?.toString(), keywords: transformedKeywords },
6062
});
6163

web/src/hooks/queries/useHomePageBlockQuery.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { useGraphqlBatcher } from "context/GraphqlBatcher";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45
import { isUndefined } from "utils/index";
56

67
import { graphql } from "src/graphql";
@@ -72,6 +73,7 @@ export const useHomePageBlockQuery = (blockNumber: number | undefined, allTime:
7273
const data = await graphqlBatcher.fetch({
7374
id: crypto.randomUUID(),
7475
document: homePageBlockQuery,
76+
chainId: DEFAULT_CHAIN,
7577
variables: { blockNumber: targetBlock },
7678
});
7779

web/src/hooks/queries/useHomePageQuery.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useQuery } from "@tanstack/react-query";
22

3+
import { DEFAULT_CHAIN } from "consts/chains";
34
import { useGraphqlBatcher } from "context/GraphqlBatcher";
45

56
import { graphql } from "src/graphql";
@@ -40,6 +41,7 @@ export const useHomePageQuery = (timeframe: number) => {
4041
const data = await graphqlBatcher.fetch({
4142
id: crypto.randomUUID(),
4243
document: homePageQuery,
44+
chainId: DEFAULT_CHAIN,
4345
variables: { timeframe: timeframe.toString() },
4446
});
4547
return data;

web/src/hooks/queries/useJurorStakeDetailsQuery.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { REFETCH_INTERVAL } from "consts/index";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45
import { useGraphqlBatcher } from "context/GraphqlBatcher";
56

67
import { graphql } from "src/graphql";
@@ -30,6 +31,11 @@ export const useJurorStakeDetailsQuery = (userId?: string) => {
3031
enabled: isEnabled,
3132
refetchInterval: REFETCH_INTERVAL,
3233
queryFn: async () =>
33-
await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: jurorStakeDetailsQuery, variables: { userId } }),
34+
await graphqlBatcher.fetch({
35+
id: crypto.randomUUID(),
36+
document: jurorStakeDetailsQuery,
37+
chainId: DEFAULT_CHAIN,
38+
variables: { userId },
39+
}),
3440
});
3541
};

web/src/hooks/queries/useLabelInfoQuery.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useQuery } from "@tanstack/react-query";
22

3+
import { DEFAULT_CHAIN } from "consts/chains";
34
import { useGraphqlBatcher } from "context/GraphqlBatcher";
45

56
import { graphql } from "src/graphql";
@@ -49,6 +50,7 @@ export const useLabelInfoQuery = (address?: string | null, disputeID?: string) =
4950
await graphqlBatcher.fetch({
5051
id: crypto.randomUUID(),
5152
document: labelQuery,
53+
chainId: DEFAULT_CHAIN,
5254
variables: { address, disputeID },
5355
}),
5456
});

web/src/hooks/queries/useTopUsersByCoherenceScore.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { useGraphqlBatcher } from "context/GraphqlBatcher";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45
import { isUndefined } from "utils/index";
56

67
import { graphql } from "src/graphql";
@@ -32,6 +33,7 @@ export const useTopUsersByCoherenceScore = (first = 5) => {
3233
? await graphqlBatcher.fetch({
3334
id: crypto.randomUUID(),
3435
document: topUsersByCoherenceScoreQuery,
36+
chainId: DEFAULT_CHAIN,
3537
variables: {
3638
first: first,
3739
orderBy: "coherenceScore",

web/src/hooks/queries/useUser.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22
import { Address } from "viem";
33

4+
import { DEFAULT_CHAIN } from "consts/chains";
45
import { useGraphqlBatcher } from "context/GraphqlBatcher";
56

67
import { graphql } from "src/graphql";
@@ -62,6 +63,7 @@ export const useUserQuery = (address?: Address, where?: Dispute_Filter) => {
6263
await graphqlBatcher.fetch({
6364
id: crypto.randomUUID(),
6465
document: query,
66+
chainId: DEFAULT_CHAIN,
6567
variables: { address: address?.toLowerCase(), where },
6668
}),
6769
});

web/src/hooks/queries/useVotingHistory.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useQuery } from "@tanstack/react-query";
22

33
import { REFETCH_INTERVAL } from "consts/index";
4+
import { DEFAULT_CHAIN } from "consts/chains";
45
import { useGraphqlBatcher } from "context/GraphqlBatcher";
56

67
import { graphql } from "src/graphql";
@@ -57,6 +58,11 @@ export const useVotingHistory = (disputeID?: string) => {
5758
enabled: isEnabled,
5859
refetchInterval: REFETCH_INTERVAL,
5960
queryFn: async () =>
60-
await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: votingHistoryQuery, variables: { disputeID } }),
61+
await graphqlBatcher.fetch({
62+
id: crypto.randomUUID(),
63+
chainId: DEFAULT_CHAIN,
64+
document: votingHistoryQuery,
65+
variables: { disputeID },
66+
}),
6167
});
6268
};

web/src/layout/Header/navbar/Menu/Settings/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const StyledTabs = styled(Tabs)`
5353
width: 86vw;
5454
max-width: 660px;
5555
align-self: center;
56+
5657
${landscapeStyle(
5758
() => css`
5859
width: ${responsiveSize(300, 424, 300)};

web/src/pages/GetPnk/Widget.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const WidgetContainer = styled.div`
1616
}
1717
}
1818
`;
19+
1920
const getWidgetConfig = (theme: Theme): WidgetConfig => ({
2021
fromChain: 1,
2122
toChain: 42161,

0 commit comments

Comments
 (0)