fix(chat): render HEIC attachments and restyle composer file chips - #6361
Conversation
The composer previewed every attachment through URL.createObjectURL of the raw bytes. No browser decodes HEVC-coded HEIF, so a HEIC showed a broken glyph, and the upload-completion handler never replaced that blob URL — so it stayed broken even once a derivative was available. - Skip the blob for HEIC/HEIF and pick up the serve URL (preview=1) once the upload lands, so the server derivative renders. - Fall back to the type icon if the image still fails to decode. - Documents render as labelled cards (icon, name, type) instead of a 9px extension caption; media keeps a thumbnail. - Fix a blob-URL leak: the unmount cleanup closed over the first render's empty array and revoked nothing.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Preview pipeline: Attachments no longer always use Chip UI: Tests: Four Vitest/jsdom cases cover document vs image rendering, HEIC thumbnail shape without preview, and preview error fallback. Reviewed by Cursor Bugbot for commit 710767e. Configure here. |
Greptile SummaryThe PR adds server-rendered previews for HEIC/HEIF attachments, improves attachment chip presentation and fallback behavior, and corrects blob URL cleanup.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/attached-files-list/attached-files-list.test.tsx | Adds focused chip-rendering tests and now uses the required absolute aliases, fully resolving the previous import finding. |
| apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/attached-files-list/attached-files-list.tsx | Introduces distinct media and document chip layouts with image-error fallback and accessible removal controls. |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-file-attachments.ts | Routes HEIC/HEIF previews through server derivatives and centralizes safe blob URL cleanup across attachment lifecycle operations. |
Reviews (3): Last reviewed commit: "chore(chat): use the absolute alias for ..." | Re-trigger Greptile
The composer is --white in light and --surface-4 in dark. The chip reused chipFilledFillTokens (--surface-5 / dark:--surface-4), which assumes a page background, so in dark mode the chip fill matched its own container exactly and only the border showed. Same for the remove badge, which sits on the shell and was 5/255 from it. - Chip fills --surface-5 in both themes and hover steps away from the shell in each theme's 'raised' direction. - Remove badge uses --surface-6, readable on white and on --surface-4. - Cap the document card at min(220px,100%) so a long filename truncates on a narrow viewport instead of overflowing the composer.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a016489. Configure here.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 710767e. Configure here.
Summary
URL.createObjectURLof the raw bytes. No browser decodes HEVC-coded HEIF, so a HEIC rendered a broken glyph — and since the upload-completion handler never replaced that blob URL, it stayed broken even once a server derivative existed.preview=1) once the upload lands, so the JPEG derivative renders. Other images keep their blob URL — no extra round trip for a thumbnail the browser can already draw.onErrorfallback: if the image still fails (transcode unavailable, 401/409), the type icon shows instead of a broken glyph.[]deps closing over the first render's empty array, so it revoked nothing, ever.Type of Change
Testing
tsc --noEmit,lint,check:api-validationclean. 1013 tests pass. Four new tests on the chip; verified the two behavioral ones fail without their fix.Not yet verified in a browser — pill proportions against the 48px tiles and the overlapping remove badge need a visual check.
Checklist