@@ -2,7 +2,9 @@ import { TABLE_LENGTH, TABLE_REFETCH_INTERVAL } from '@/config';
22import { execute } from '@/graphql/execute' ;
33import { useQuery } from '@tanstack/react-query' ;
44import { createFileRoute } from '@tanstack/react-router' ;
5+ import { useSearch , useNavigate } from '@tanstack/react-router' ;
56import { LoaderCircle } from 'lucide-react' ;
7+ import { useEffect } from 'react' ;
68import AddressIcon from '@/components/icons/AddressIcon' ;
79import { BackButton } from '@/components/ui/BackButton' ;
810import { useTabParam } from '@/hooks/usePageParam' ;
@@ -74,7 +76,7 @@ function AddressRoute() {
7476 'WORKERPOOLS' ,
7577 ] ;
7678 const [ currentTab , setCurrentTab ] = useTabParam ( 'addressTab' , tabLabels , 0 ) ;
77- const { chainId } = useUserStore ( ) ;
79+ const { chainId, address : userAddress } = useUserStore ( ) ;
7880 const { addressAddress } = Route . useParams ( ) ;
7981 const {
8082 data : address ,
@@ -86,6 +88,29 @@ function AddressRoute() {
8688 error,
8789 } = useAddressData ( ( addressAddress as string ) . toLowerCase ( ) , chainId ! ) ;
8890
91+ const navigate = useNavigate ( ) ;
92+ const search = useSearch ( { strict : false } ) ;
93+ const { chainSlug } = Route . useParams ( ) ;
94+ const fromMyActivity = search ?. [ 'from' ] === 'my_activity' ;
95+
96+ useEffect ( ( ) => {
97+ if (
98+ fromMyActivity &&
99+ userAddress &&
100+ addressAddress ?. toLowerCase ( ) !== userAddress ?. toLowerCase ( )
101+ ) {
102+ navigate ( {
103+ to : `/${ chainSlug } /address/${ userAddress } ` ,
104+ search : ( prev : Record < string , any > ) => ( {
105+ ...prev ,
106+ from : 'my_activity' ,
107+ } ) ,
108+ replace : true ,
109+ resetScroll : false ,
110+ } ) ;
111+ }
112+ } , [ userAddress , addressAddress , fromMyActivity , navigate , chainSlug ] ) ;
113+
89114 const addressDetails = address ? buildAddressDetails ( { address } ) : undefined ;
90115 const addressOverview = address
91116 ? buildAddressOverview ( { address } )
0 commit comments