@@ -18,7 +18,7 @@ import type { TestCaseSummary, TestFileSummary } from './types';
1818import * as React from 'react' ;
1919import { msToString } from './utils' ;
2020import { Chip } from './chip' ;
21- import { Link , LinkBadge , SearchParamsContext , testResultHref , TraceLink } from './links' ;
21+ import { Link , LinkBadge , testResultHref , TraceLink , useSearchParams } from './links' ;
2222import { statusIcon } from './statusIcon' ;
2323import './testFileView.css' ;
2424import { video , image } from './icons' ;
@@ -32,7 +32,7 @@ export const TestFileView: React.FC<React.PropsWithChildren<{
3232 setFileExpanded ?: ( fileId : string , expanded : boolean ) => void ;
3333 footer ?: React . JSX . Element | string ;
3434} > > = ( { file, projectNames, isFileExpanded, setFileExpanded, footer } ) => {
35- const searchParams = React . useContext ( SearchParamsContext ) ;
35+ const searchParams = useSearchParams ( ) ;
3636 return < Chip
3737 expanded = { isFileExpanded ? isFileExpanded ( file . fileId ) : undefined }
3838 noInsets = { true }
@@ -74,7 +74,7 @@ export const TestFileView: React.FC<React.PropsWithChildren<{
7474} ;
7575
7676function ImageDiffBadge ( { test } : { test : TestCaseSummary } ) {
77- const searchParams = React . useContext ( SearchParamsContext ) ;
77+ const searchParams = useSearchParams ( ) ;
7878 for ( const result of test . results ) {
7979 for ( const attachment of result . attachments ) {
8080 if ( attachment . contentType . startsWith ( 'image/' ) && ! ! attachment . name . match ( / - ( e x p e c t e d | a c t u a l | d i f f ) / ) )
@@ -84,7 +84,7 @@ function ImageDiffBadge({ test }: { test: TestCaseSummary }) {
8484}
8585
8686function VideoBadge ( { test } : { test : TestCaseSummary } ) {
87- const searchParams = React . useContext ( SearchParamsContext ) ;
87+ const searchParams = useSearchParams ( ) ;
8888 const resultWithVideo = test . results . find ( result => result . attachments . some ( attachment => attachment . name === 'video' ) ) ;
8989 return resultWithVideo ? < LinkBadge href = { testResultHref ( { test, result : resultWithVideo , anchor : 'attachment-video' } , searchParams ) } title = 'View video' dim = { true } > { video ( ) } </ LinkBadge > : undefined ;
9090}
0 commit comments