Skip to content

Commit

Permalink
fix: handle non-string values in UUIDTag
Browse files Browse the repository at this point in the history
  • Loading branch information
yunchipang committed Oct 29, 2024
1 parent c6b429e commit c40c5ab
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/common/UUIDTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { Box, Tooltip, Typography } from '@mui/material';
import { useClipboard } from 'hooks/globalHooks';

function UUIDTag({ uuid, sx }) {
const formattedId = `${uuid.slice(0, 4)}...${uuid.slice(
uuid.length - 4,
uuid.length,
const id = typeof uuid === 'string' ? uuid : String(uuid || '');

const formattedId = `${id.slice(0, 4)}...${id.slice(
id.length - 4,
id.length,
)}`;

const { onCopy, hasCopied } = useClipboard(uuid);
const { onCopy, hasCopied } = useClipboard(id);

const title = (
<>
Expand Down

0 comments on commit c40c5ab

Please sign in to comment.