@@ -22,10 +22,17 @@ export default function SupportErrorMessage({
2222 timestamp,
2323} : SupportErrorMessageProps ) {
2424 const t = useTranslations ( "Errors" ) ;
25- const [ details , setDetails ] = useState ( {
26- pageUrl : pageUrl ? sanitiseSupportPageUrl ( pageUrl ) : "" ,
27- timestamp : timestamp ?? "" ,
28- } ) ;
25+ const [ details , setDetails ] = useState < {
26+ pageUrl : string ;
27+ timestamp : string ;
28+ } | null > (
29+ pageUrl && timestamp
30+ ? {
31+ pageUrl : sanitiseSupportPageUrl ( pageUrl ) ,
32+ timestamp,
33+ }
34+ : null
35+ ) ;
2936
3037 useEffect ( ( ) => {
3138 setDetails ( {
@@ -43,21 +50,24 @@ export default function SupportErrorMessage({
4350 < >
4451 { message . endsWith ( "." ) ? message : `${ message } .` } { " " }
4552 { t . rich ( "supportContact" , {
46- contact : ( chunks ) => (
47- < EncodedEmailLink
48- as = "plain"
49- address = { siteConfig . encodedEmail . team }
50- body = { t ( bodyKey , {
51- area,
52- pageUrl : details . pageUrl ,
53- reference : supportReference ?? "" ,
54- timestamp : details . timestamp ,
55- } ) }
56- subject = { t ( "supportEmailSubject" , { area } ) }
57- >
58- { chunks }
59- </ EncodedEmailLink >
60- ) ,
53+ contact : ( chunks ) =>
54+ details ? (
55+ < EncodedEmailLink
56+ as = "plain"
57+ address = { siteConfig . encodedEmail . team }
58+ body = { t ( bodyKey , {
59+ area,
60+ pageUrl : details . pageUrl ,
61+ reference : supportReference ?? "" ,
62+ timestamp : details . timestamp ,
63+ } ) }
64+ subject = { t ( "supportEmailSubject" , { area } ) }
65+ >
66+ { chunks }
67+ </ EncodedEmailLink >
68+ ) : (
69+ chunks
70+ ) ,
6171 } ) }
6272 </ >
6373 ) ;
0 commit comments