Skip to content

Commit 579df2a

Browse files
authored
fix: Completed replacing crypto.randomUUID with natural keys (#74)
* fix: Completed replacing crypto.randomUUID with natural keys. Removed redundant keys in several components * fix: Removed unused component
1 parent f1bae95 commit 579df2a

File tree

5 files changed

+10
-46
lines changed

5 files changed

+10
-46
lines changed

packages/editor/src/components/GraphQlOperationViewer.tsx

Lines changed: 0 additions & 36 deletions
This file was deleted.

packages/portal/src/components/ApiDocumentList.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { Link, List, ListItem, ListItemIcon, ListItemText, Skeleton } from '@mui/material'
18+
import { SpecLogo } from '@netcracker/qubership-apihub-ui-shared/components/SpecLogo'
1719
import type { FC } from 'react'
1820
import { memo } from 'react'
19-
import { Link, List, ListItem, ListItemIcon, ListItemText, Skeleton } from '@mui/material'
2021
import type { To } from 'react-router-dom'
2122
import { NavLink } from 'react-router-dom'
22-
import { SpecLogo } from '@netcracker/qubership-apihub-ui-shared/components/SpecLogo'
2323

2424
export type ApiDocumentListProps = {
2525
isLoading: boolean
@@ -29,19 +29,19 @@ export type ApiDocumentListProps = {
2929
export const ApiDocumentList: FC<ApiDocumentListProps> = memo<ApiDocumentListProps>(({ value, isLoading }) => {
3030
if (isLoading) {
3131
return (
32-
<Skeleton variant="rectangular" width={150}/>
32+
<Skeleton variant="rectangular" width={150} />
3333
)
3434
}
3535

3636
return (
3737
<List>
3838
{value.map(({ type, title, url, subtitle }) => (
3939
<ListItem
40-
key={crypto.randomUUID()}
40+
key={`api-document-${type}-${title}`}
4141
sx={{ px: 0, alignItems: 'start' }}
4242
>
4343
<ListItemIcon sx={{ minWidth: 2, mt: 0, mr: 1 }}>
44-
<SpecLogo value={type}/>
44+
<SpecLogo value={type} />
4545
</ListItemIcon>
4646
<ListItemText
4747
primary={

packages/portal/src/components/GraphQlOperationViewer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const GraphQlOperationViewer: FC<GraphQlOperationViewerProps> = memo<Grap
2929
return (
3030
<Box lineHeight={1.5} height="100%">
3131
<GraphQLOperationViewer
32-
key={`graphql-operation-viewer-${displayMode}`}
3332
source={source}
3433
displayMode={displayMode}
3534
/>

packages/portal/src/routes/root/PortalPage/VersionPage/OpenApiViewer/OpenApiTableTreeSkeleton.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ import { Box, Skeleton, TableCell, TableRow } from '@mui/material'
2121
export const OpenApiTableTreeSkeleton: FC = memo(() => {
2222
return (
2323
<>
24-
{Array(2).fill(0).map(() => {
24+
{/* eslint-disable-next-line @typescript-eslint/no-unused-vars */}
25+
{Array(2).fill(0).map((_, index) => {
2526
return (
26-
<TableRow key={crypto.randomUUID()}>
27-
<TableCell key={crypto.randomUUID()}>
27+
<TableRow key={index}>
28+
<TableCell>
2829
<Box display="flex" flexDirection="column">
2930
<Skeleton sx={{ width: '100%', height: '32px' }}/>
3031
<Skeleton sx={{ width: '25%', height: '18px' }}/>

packages/shared/src/components/Selector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const Selector: FC<SelectorProps> = memo<SelectorProps>(({
104104
>
105105
{options?.map((option) => (
106106
<MenuItem
107-
key={crypto.randomUUID()}
107+
key={`selector-option-${option.value}`}
108108
onClick={() => {
109109
onChange?.(option)
110110
setAnchor(undefined)

0 commit comments

Comments
 (0)