@@ -13,9 +13,8 @@ import { Trans } from "react-i18next";
1313import type React from "react" ;
1414import contributors from "../../../../../contributors.json" ;
1515import { Fragment } from "preact/jsx-runtime" ;
16- import { ComponentChildren } from "preact" ;
17- import { useMemo } from "react" ;
18- import { memo } from "preact/compat" ;
16+ import type { ComponentChildren } from "preact" ;
17+ import { useMemo , memo } from "preact/compat" ;
1918import clsx from "clsx" ;
2019
2120export default function AboutDialog ( ) {
@@ -25,22 +24,26 @@ export default function AboutDialog() {
2524 const [ icon , setIcon ] = useState ( "default" ) ;
2625 const [ altIcon , setAltIcon ] = useState < string | null > ( null ) ;
2726
27+ const hasLoaded = useRef ( false ) ;
28+
2829 const onLoad = useCallback ( async ( ) => {
29- if ( ! appInfo ) {
30+ if ( ! hasLoaded . current ) {
3031 const info = await server . get < AppInfo > ( "app-info" ) ;
3132 if ( info . appVersion . includes ( "test" ) ) {
3233 setNightly ( true ) ;
3334 setIcon ( "nightly" ) ;
3435 }
3536 setAppInfo ( info ) ;
37+ hasLoaded . current = true ;
38+
3639 }
3740 setIsShown ( true ) ;
3841 } , [ ] ) ;
3942
4043 useTriliumEvent ( "openAboutDialog" , onLoad ) ;
4144
42- const createContributorHoverHandler = useCallback ( ( ) => {
43- let timeoutID ;
45+ const createContributorHoverHandler = ( ) => {
46+ let timeoutID : ReturnType < typeof setTimeout > ;
4447 return ( contributor : Contributor , isHovering : boolean , part : "name" | "role" ) => {
4548 if ( part === "role" && contributor . role === "original-dev" ) {
4649 if ( isHovering ) {
@@ -53,7 +56,7 @@ export default function AboutDialog() {
5356 }
5457 }
5558 }
56- } , [ ] ) ;
59+ } ;
5760
5861 /* Cache the contributor list to prevent its rerendering.
5962 * When the icon changes, it triggers a rerender of the dialog. If this happens while an
@@ -77,7 +80,7 @@ export default function AboutDialog() {
7780
7881 < div className = { "icon" } data-icon = { altIcon ?? icon } />
7982 < h2 > Trilium Notes { isNightly && < span className = "channel-name" > Nightly</ span > } </ h2 >
80- < a className = "tn-link" href = "https://triliumnotes.org/" target = "_blank" >
83+ < a className = "tn-link" href = "https://triliumnotes.org/" target = "_blank" rel = "noopener noreferrer" >
8184 triliumnotes.org
8285 </ a >
8386
@@ -95,7 +98,7 @@ export default function AboutDialog() {
9598 buildDate : appInfo ?. buildDate ? formatDateTime ( appInfo . buildDate ) : ""
9699 } }
97100 components = { {
98- buildRevision : RevisionLink ( appInfo )
101+ buildRevision : < RevisionLink appInfo = { appInfo } /> as React . ReactElement
99102 } }
100103 />
101104 </ div >
@@ -104,7 +107,7 @@ export default function AboutDialog() {
104107 < PropertySheetItem className = "contributor-list use-tn-links" label = { t ( "about.contributors_label" ) } >
105108 < CachedContributors />
106109
107- < a href = "https://github.com/TriliumNext/Trilium/graphs/contributors" target = "_blank" >
110+ < a href = "https://github.com/TriliumNext/Trilium/graphs/contributors" target = "_blank" rel = "noopener noreferrer" >
108111 { t ( "about.contributor_full_list" ) }
109112 </ a >
110113 </ PropertySheetItem >
@@ -123,7 +126,7 @@ export default function AboutDialog() {
123126 url = "https://github.com/TriliumNext/Trilium"
124127 tooltip = { t ( "about.github_tooltip" ) } >
125128
126- < i class = 'bx bxl-github' > </ i >
129+ < i className = 'bx bxl-github' > </ i >
127130 </ FooterLink >
128131
129132 < FooterLink
@@ -141,19 +144,19 @@ export default function AboutDialog() {
141144 tooltip = { t ( "about.donate_tooltip" ) }
142145 className = "donate-link" >
143146
144- < i class = 'bx bx-heart' > </ i >
147+ < i className = 'bx bx-heart' > </ i >
145148 </ FooterLink >
146149 </ footer >
147150 </ Modal >
148151 ) ;
149152}
150153
151- function RevisionLink ( appInfo : AppInfo | null ) {
154+ function RevisionLink ( { appInfo} : { appInfo : AppInfo | null } ) {
152155 return < >
153- { appInfo ?. buildRevision && < a href = { `https://github.com/TriliumNext/Trilium/commit/${ appInfo . buildRevision } ` } target = "_blank" className = "tn-link" >
156+ { appInfo ?. buildRevision && < a href = { `https://github.com/TriliumNext/Trilium/commit/${ appInfo . buildRevision } ` } target = "_blank" rel = "noopener noreferrer" className = "tn-link" >
154157 { appInfo . buildRevision . substring ( 0 , 7 ) }
155158 </ a > }
156- </ > as React . ReactElement ;
159+ </ > ;
157160}
158161
159162function FooterLink ( props : { children : ComponentChildren , text : string , url : string , tooltip : string , className ?: string } ) {
@@ -166,7 +169,7 @@ function FooterLink(props: {children: ComponentChildren, text: string, url: stri
166169 placement : "bottom"
167170 } )
168171
169- return < a ref = { linkRef } href = { props . url } className = { props . className } target = "_blank" draggable = { false } >
172+ return < a ref = { linkRef } href = { props . url } className = { props . className } target = "_blank" rel = "noopener noreferrer" draggable = { false } >
170173 { props . children }
171174 { props . text }
172175 </ a >
@@ -202,16 +205,17 @@ function ContributorListItem({data, onHover}: {data: Contributor, onHover?: Hove
202205 < a
203206 href = { data . url }
204207 target = "_blank"
205- onMouseEnter = { ( e ) => onHover ?.( data , true , "name" ) }
206- onMouseLeave = { ( e ) => onHover ?.( data , false , "name" ) } >
208+ rel = "noopener noreferrer"
209+ onMouseEnter = { ( ) => onHover ?.( data , true , "name" ) }
210+ onMouseLeave = { ( ) => onHover ?.( data , false , "name" ) } >
207211
208212 { data . fullName ?? data . name }
209213 </ a >
210214
211215 { roleString && < span
212216 ref = { roleRef }
213- onMouseEnter = { ( e ) => onHover ?.( data , true , "role" ) }
214- onMouseLeave = { ( e ) => onHover ?.( data , false , "role" ) } >
217+ onMouseEnter = { ( ) => onHover ?.( data , true , "role" ) }
218+ onMouseLeave = { ( ) => onHover ?.( data , false , "role" ) } >
215219
216220 (< span className = "contributor-role" > { roleString } </ span > )
217221 </ span > }
0 commit comments