fix: Bug - Sending files and attachment issues (gallery load and speed)

Route small images through in-memory receive instead of serialized disk
chunk-acks, and improve gallery hydration for local copies and pending
downloads so thumbnails display without minutes-long progress stalls.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-14 13:19:12 +02:00
co-authored by Cursor
parent fa45052432
commit b13f71d2d3
12 changed files with 206 additions and 34 deletions
@@ -4,7 +4,7 @@ import {
it
} from 'vitest';
import { buildChatMessageGalleryTiles } from './chat-message-image-gallery.rules';
import { buildChatMessageGalleryTiles, resolveChatMessageGalleryTileState } from './chat-message-image-gallery.rules';
describe('buildChatMessageGalleryTiles', () => {
it('marks displayable, hydrating, downloading, and retry tiles from attachment state', () => {
@@ -51,4 +51,18 @@ describe('buildChatMessageGalleryTiles', () => {
'retry'
]);
});
it('treats zero-byte pending requests as downloading instead of retry', () => {
const attachment = {
id: 'pending',
filename: 'waiting.png',
mime: 'image/png',
isImage: true,
available: false,
size: 256
};
expect(resolveChatMessageGalleryTileState(attachment)).toBe('retry');
expect(resolveChatMessageGalleryTileState(attachment, { pendingRequest: true })).toBe('downloading');
});
});