From ad785cdd9af05054cbfd59fa5f7dad63181ae70a Mon Sep 17 00:00:00 2001 From: Marek Mihok Date: Sun, 20 Aug 2023 21:57:38 +0200 Subject: [PATCH] fix: show input button when label is not defined #2025 --- ui/src/copyable_text.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/copyable_text.tsx b/ui/src/copyable_text.tsx index f64e3d8c7c..7674fcd0a1 100644 --- a/ui/src/copyable_text.tsx +++ b/ui/src/copyable_text.tsx @@ -64,7 +64,7 @@ export interface CopyableText { height?: S } -type CopyButton = { +type ClipboardCopyButton = { /** Text to be copied to clipboard. */ value: S, /** The element to which the copy button is attached. */ @@ -75,7 +75,7 @@ type CopyButton = { portal?: B } -export const ClipboardCopyButton = ({ value, anchorElement, showOnHoverOnly = false, portal = false }: CopyButton) => { +export const ClipboardCopyButton = ({ value, anchorElement, showOnHoverOnly = false, portal = false }: ClipboardCopyButton) => { const timeoutRef = React.useRef(), [copied, setCopied] = React.useState(false), @@ -125,9 +125,9 @@ export const XCopyableText = ({ model }: { model: CopyableText }) => { heightStyle = multiline && height === '1' ? fullHeightStyle : undefined, [inputEl, setInputEl] = React.useState(), domRef = React.useCallback(node => { - const inputEl = node?.children[0]?.children[1] + const inputEl = node?.children[0]?.children[label ? 1 : 0] if (inputEl) setInputEl(inputEl) - }, []) + }, [label]) return ( <>