Skip to content

Commit

Permalink
Merge pull request #1633 from kleros/fix/add-externaldisputeid-to-que…
Browse files Browse the repository at this point in the history
…ry-key

fix: add externaldisputeid to query key in populate hook, remove must…
  • Loading branch information
alcercu committed Jun 28, 2024
2 parents 9ea71a5 + fb01ed8 commit d701b0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit d701b0d

Please sign in to comment.