Skip to content

Commit aacb4c7

Browse files
authored
Merge pull request #679 from miurla/fix/message-actions-visibility
fix: avoid invisible action row in text parts
2 parents 9560f73 + bd3bc82 commit aacb4c7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

components/message-actions.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ export function MessageActions({
4444
const [isSubmittingFeedback, setIsSubmittingFeedback] = useState(false)
4545
const isLoading = status === 'submitted' || status === 'streaming'
4646

47+
// Do not render at all when actions should be hidden.
48+
// Rendering while loading is allowed so previous messages keep their actions
49+
// visible even during a new message's streaming.
50+
if (!visible) {
51+
return null
52+
}
53+
4754
async function handleCopy() {
4855
await navigator.clipboard.writeText(message)
4956
toast.success('Message copied to clipboard')
@@ -87,7 +94,7 @@ export function MessageActions({
8794
<div
8895
className={cn(
8996
'flex items-center gap-0.5 self-end transition-opacity duration-200',
90-
!visible || isLoading ? 'opacity-0' : 'opacity-100',
97+
'opacity-100',
9198
className
9299
)}
93100
>

0 commit comments

Comments
 (0)