From c40c5abb804d6baa4c6e25dc7ee091995dc8ee56 Mon Sep 17 00:00:00 2001 From: yunchipang Date: Mon, 28 Oct 2024 18:53:47 -0700 Subject: [PATCH] fix: handle non-string values in UUIDTag --- src/components/common/UUIDTag.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/common/UUIDTag.js b/src/components/common/UUIDTag.js index aef50fa5a..7e7d7d050 100644 --- a/src/components/common/UUIDTag.js +++ b/src/components/common/UUIDTag.js @@ -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 = ( <>