File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
pages/TrustRoot/components Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -16,16 +16,16 @@ export const useWithUiId = <T>(
16
16
/** Source data to modify. */
17
17
data : T [ ] | undefined ,
18
18
/** Generate the unique id for a specific `T`. */
19
- generator : ( item : T ) => string
19
+ generator : ( item : T , index : number ) => string
20
20
) : WithUiId < T > [ ] => {
21
21
const result = useMemo ( ( ) => {
22
22
if ( ! data || data . length === 0 ) {
23
23
return [ ] ;
24
24
}
25
25
26
- const dataWithUiId : WithUiId < T > [ ] = data . map ( ( item ) => ( {
26
+ const dataWithUiId : WithUiId < T > [ ] = data . map ( ( item , index ) => ( {
27
27
...item ,
28
- [ UI_UNIQUE_ID ] : generator ( item ) ,
28
+ [ UI_UNIQUE_ID ] : generator ( item , index ) ,
29
29
} ) ) ;
30
30
31
31
return dataWithUiId ;
Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ interface ICertificatesTableProps {
35
35
}
36
36
37
37
export const CertificatesTable : React . FC < ICertificatesTableProps > = ( { certificates, isFetching, fetchError } ) => {
38
- const items = useWithUiId ( certificates , ( item ) => `${ item . type } -${ item . issuer } -${ item . subject } -${ item . target } ` ) ;
38
+ const items = useWithUiId (
39
+ certificates ,
40
+ ( item , index ) => `${ index } -${ item . type } -${ item . issuer } -${ item . subject } -${ item . target } `
41
+ ) ;
39
42
40
43
const tableState = usePFToolbarTable ( {
41
44
items,
You can’t perform that action at this time.
0 commit comments