Skip to content

Commit 3d9dff9

Browse files
committed
Update prompt-input.tsx
1 parent 1ef040a commit 3d9dff9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/elements/src/prompt-input.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,15 @@ export function PromptInputAttachments({
342342
return () => ro.disconnect();
343343
}, []);
344344

345+
// biome-ignore lint/correctness/useExhaustiveDependencies: Force height measurement when attachments change
346+
useLayoutEffect(() => {
347+
const el = contentRef.current;
348+
if (!el) {
349+
return;
350+
}
351+
setHeight(el.getBoundingClientRect().height);
352+
}, [attachments.files.length]);
353+
345354
if (attachments.files.length === 0) {
346355
return null;
347356
}
@@ -357,7 +366,7 @@ export function PromptInputAttachments({
357366
style={{ height: attachments.files.length ? height : 0 }}
358367
{...props}
359368
>
360-
<div className="space-y-2 p-3 pt-3" ref={contentRef}>
369+
<div className="space-y-2 py-1" ref={contentRef}>
361370
<div className="flex flex-wrap gap-2">
362371
{attachments.files
363372
.filter((f) => !(f.mediaType?.startsWith("image/") && f.url))

0 commit comments

Comments
 (0)