@@ -11,9 +11,9 @@ import { useStepProcessDialogContext } from "../global/step-process-dialog";
1111import { createExtraContent } from "../global/extra-content" ;
1212import { revalidatePathServerAction } from "@/app/actions/revalidatePathServerAction" ;
1313import { useState } from "react" ;
14- import { useQueryClient } from "@tanstack/react-query" ;
14+ // import { useQueryClient } from "@tanstack/react-query";
1515import { getAddress } from "viem" ;
16- import { useOwnedHypercerts } from "@/hooks/useOwnedHypercerts" ;
16+ // import { useOwnedHypercerts } from "@/hooks/useOwnedHypercerts";
1717
1818interface UnclaimedHypercertClaimButtonProps {
1919 allowListRecord : Row < AllowListRecord > ;
@@ -31,19 +31,28 @@ export default function UnclaimedHypercertClaimButton({
3131 useStepProcessDialogContext ( ) ;
3232 const { switchChain } = useSwitchChain ( ) ;
3333 const router = useRouter ( ) ;
34- const query = useOwnedHypercerts ( getAddress ( account . address ! ) ) ;
34+ // const query = useOwnedHypercerts(getAddress(account.address!));
3535
3636 const selectedHypercert = allowListRecord . original ;
3737 const hypercertChainId = selectedHypercert ?. hypercert_id ?. split ( "-" ) [ 0 ] ;
3838
3939 const refreshData = async ( address : string ) => {
4040 await revalidatePathServerAction ( [
41- `/profile/${ address } ?tab=hypercerts-claimable` ,
42- `/profile/${ address } ?tab=hypercerts-owned` ,
43- `/hypercerts/${ selectedHypercert ?. hypercert_id } ` ,
44- ] ) ;
45- await query . refetch ( ) ;
46- router . refresh ( ) ;
41+ { path : `/profile/${ address } ?tab` , type : "page" } ,
42+ { path : `/profile/${ address } ?tab=hypercerts-claimable` , type : "page" } ,
43+ { path : `/profile/${ address } ?tab=hypercerts-owned` , type : "page" } ,
44+ { path : `/hypercerts/${ selectedHypercert ?. hypercert_id } ` , type : "page" } ,
45+ { path : "/" , type : "layout" } ,
46+ ] ) . then ( async ( ) => {
47+ setTimeout ( ( ) => {
48+ // refresh after 5 seconds
49+ router . refresh ( ) ;
50+
51+ // push to the profile page with the hypercerts-claimable tab
52+ // because revalidatePath will revalidate on the next page visit.
53+ router . push ( `/profile/${ address } ?tab=hypercerts-claimable` ) ;
54+ } , 5000 ) ;
55+ } ) ;
4756 } ;
4857
4958 const claimHypercert = async ( ) => {
@@ -111,9 +120,6 @@ export default function UnclaimedHypercertClaimButton({
111120 } else if ( receipt . status == "reverted" ) {
112121 await setDialogStep ( "confirming" , "error" , "Transaction reverted" ) ;
113122 }
114- setTimeout ( ( ) => {
115- refresh ( ) ;
116- } , 5000 ) ;
117123 } catch ( error ) {
118124 console . error ( error ) ;
119125 } finally {
0 commit comments