@@ -19,6 +19,7 @@ import {Button, Dropdown, Modal, Space, Tag, Typography} from "antd"
1919import clsx from "clsx"
2020import { useAtom , useAtomValue , useSetAtom } from "jotai"
2121import dynamic from "next/dynamic"
22+ import { useRouter } from "next/router"
2223
2324import {
2425 InfiniteVirtualTableFeatureShell ,
@@ -87,6 +88,7 @@ const TestsetsTable = ({
8788 onSelectRevision,
8889 selectedRevisionId,
8990} : TestsetsTableProps ) => {
91+ const router = useRouter ( )
9092 const { projectURL} = useURL ( )
9193 const projectId = useAtomValue ( projectIdAtom )
9294
@@ -192,7 +194,7 @@ const TestsetsTable = ({
192194
193195 // If it's a revision, navigate to it directly
194196 if ( isRevision ) {
195- window . location . href = `${ projectURL } /testsets/${ record . id } `
197+ router . push ( `${ projectURL } /testsets/${ record . id } ` )
196198 return
197199 }
198200
@@ -202,7 +204,7 @@ const TestsetsTable = ({
202204 if ( cachedChildren && cachedChildren . length > 0 ) {
203205 // Navigate to the first child (latest revision)
204206 const latestRevision = cachedChildren [ 0 ]
205- window . location . href = `${ projectURL } /testsets/${ latestRevision . id } `
207+ router . push ( `${ projectURL } /testsets/${ latestRevision . id } ` )
206208 return
207209 }
208210
@@ -216,13 +218,13 @@ const TestsetsTable = ({
216218 )
217219 if ( revisions . length > 0 ) {
218220 // Navigate to the first revision (latest)
219- window . location . href = `${ projectURL } /testsets/${ revisions [ 0 ] . id } `
221+ router . push ( `${ projectURL } /testsets/${ revisions [ 0 ] . id } ` )
220222 }
221223 } catch ( error ) {
222224 console . error ( "[TestsetsTable] Failed to fetch revisions for navigation:" , error )
223225 }
224226 } ,
225- [ projectURL , childrenCache , isSelectMode , onSelectRevision ] ,
227+ [ projectURL , childrenCache , isSelectMode , onSelectRevision , router ] ,
226228 )
227229
228230 // Action handlers - consolidated
0 commit comments