mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-08 03:54:18 +00:00
Prevent the crash on client-side in case of text
being undefined in FancyTextDisplay
(#481)
* Prevent the crash on client-side in case of `text` being undefined in `FancyTextDisplay` * Use `String(text)` instead
This commit is contained in:
parent
ad78f1dcd7
commit
dd53a36d5f
@ -17,6 +17,7 @@ interface Props {
|
|||||||
const FancyTextDisplay: React.FC<Props> = ({text, className, isPossibleToCopy = true, applyTextEllipsis = true, flipped = false, useTooltip= false, displayIconOnMouseOver = false, buttonOnly = false}) => {
|
const FancyTextDisplay: React.FC<Props> = ({text, className, isPossibleToCopy = true, applyTextEllipsis = true, flipped = false, useTooltip= false, displayIconOnMouseOver = false, buttonOnly = false}) => {
|
||||||
const [showCopiedNotification, setCopied] = useState(false);
|
const [showCopiedNotification, setCopied] = useState(false);
|
||||||
const [showTooltip, setShowTooltip] = useState(false);
|
const [showTooltip, setShowTooltip] = useState(false);
|
||||||
|
text = String(text);
|
||||||
|
|
||||||
const onCopy = () => {
|
const onCopy = () => {
|
||||||
setCopied(true)
|
setCopied(true)
|
||||||
@ -47,7 +48,7 @@ const FancyTextDisplay: React.FC<Props> = ({text, className, isPossibleToCopy =
|
|||||||
return (
|
return (
|
||||||
<p
|
<p
|
||||||
className={`FancyTextDisplay-Container ${className ? className : ''} ${displayIconOnMouseOver ? 'displayIconOnMouseOver ' : ''} ${applyTextEllipsis ? ' FancyTextDisplay-ContainerEllipsis' : ''}`}
|
className={`FancyTextDisplay-Container ${className ? className : ''} ${displayIconOnMouseOver ? 'displayIconOnMouseOver ' : ''} ${applyTextEllipsis ? ' FancyTextDisplay-ContainerEllipsis' : ''}`}
|
||||||
title={text.toString()}
|
title={text}
|
||||||
onMouseOver={ e => setShowTooltip(true)}
|
onMouseOver={ e => setShowTooltip(true)}
|
||||||
onMouseLeave={ e => setShowTooltip(false)}
|
onMouseLeave={ e => setShowTooltip(false)}
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user