@@ -11,9 +11,9 @@ import { useStepProcessDialogContext } from "../global/step-process-dialog";
11
11
import { createExtraContent } from "../global/extra-content" ;
12
12
import { revalidatePathServerAction } from "@/app/actions/revalidatePathServerAction" ;
13
13
import { useState } from "react" ;
14
- import { useQueryClient } from "@tanstack/react-query" ;
14
+ // import { useQueryClient } from "@tanstack/react-query";
15
15
import { getAddress } from "viem" ;
16
- import { useOwnedHypercerts } from "@/hooks/useOwnedHypercerts" ;
16
+ // import { useOwnedHypercerts } from "@/hooks/useOwnedHypercerts";
17
17
18
18
interface UnclaimedHypercertClaimButtonProps {
19
19
allowListRecord : Row < AllowListRecord > ;
@@ -31,19 +31,28 @@ export default function UnclaimedHypercertClaimButton({
31
31
useStepProcessDialogContext ( ) ;
32
32
const { switchChain } = useSwitchChain ( ) ;
33
33
const router = useRouter ( ) ;
34
- const query = useOwnedHypercerts ( getAddress ( account . address ! ) ) ;
34
+ // const query = useOwnedHypercerts(getAddress(account.address!));
35
35
36
36
const selectedHypercert = allowListRecord . original ;
37
37
const hypercertChainId = selectedHypercert ?. hypercert_id ?. split ( "-" ) [ 0 ] ;
38
38
39
39
const refreshData = async ( address : string ) => {
40
40
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
+ } ) ;
47
56
} ;
48
57
49
58
const claimHypercert = async ( ) => {
@@ -111,9 +120,6 @@ export default function UnclaimedHypercertClaimButton({
111
120
} else if ( receipt . status == "reverted" ) {
112
121
await setDialogStep ( "confirming" , "error" , "Transaction reverted" ) ;
113
122
}
114
- setTimeout ( ( ) => {
115
- refresh ( ) ;
116
- } , 5000 ) ;
117
123
} catch ( error ) {
118
124
console . error ( error ) ;
119
125
} finally {
0 commit comments