Skip to content

fix: add externaldisputeid to query key in populate hook, remove must… #1633

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 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion kleros-sdk/src/dataMappings/utils/populateTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { validate } from "./DisputeDetailsValidator";

export const populateTemplate = (mustacheTemplate: string, data: any): DisputeDetails => {
const render = mustache.render(mustacheTemplate, data);
console.log("MUSTACHE RENDER: ", render);
const dispute = JSON.parse(render);

// TODO: the validation below is too strict, it should be fixed, disabled for now, FIXME
Expand Down
8 changes: 6 additions & 2 deletions web/src/hooks/queries/usePopulatedDisputeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ const disputeTemplateQuery = graphql(`
export const usePopulatedDisputeData = (disputeID?: string, arbitrableAddress?: `0x${string}`) => {
const publicClient = usePublicClient();
const { data: crossChainData, isError } = useIsCrossChainDispute(disputeID, arbitrableAddress);
const isEnabled = !isUndefined(disputeID) && !isUndefined(crossChainData) && !isUndefined(arbitrableAddress);
const { graphqlBatcher } = useGraphqlBatcher();
const { data: externalDisputeID } = useEvidenceGroup(disputeID, arbitrableAddress);
const isEnabled =
!isUndefined(disputeID) &&
!isUndefined(crossChainData) &&
!isUndefined(arbitrableAddress) &&
!isUndefined(externalDisputeID);

return useQuery<DisputeDetails>({
queryKey: [`DisputeTemplate${disputeID}${arbitrableAddress}`],
queryKey: [`DisputeTemplate${disputeID}${arbitrableAddress}${externalDisputeID}`],
enabled: isEnabled,
staleTime: Infinity,
queryFn: async () => {
Expand Down
Loading