Repository navigation
perf(web): compress large PNG uploads and reuse bounded LRU image cache - #1286
Merged
Merged
Conversation
|
Caution Review failedThe pull request is closed. Summary
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Optimize Web UI image upload payload size and transcript image display latency, especially across remote Peer sessions and
#1247background session eviction:> 1 MiBor longest edge> 2048px) to high-clarityimage/webp(0.9quality, max edge2048px) before upload, strictly falling back to scaled PNG (when WebP encoding is unsupported and scaled PNG is smaller) or the original file when output is not smaller or encoding fails.SessionBindingimage URL map with a cross-session bounded LRU cache (32entries /24 MiBcap, automaticURL.revokeObjectURLon eviction and disposal) so historical images survive#1247background session eviction without re-downloading.Blobs immediately on upload completion (indexed by exactattachmentIdplus session-scoped content-leaf,(name, bytes), and unambiguous pending-name fallbacks for remote peerpeer-image:*placeholders) and adopt seeded URLs without triggering a canonicalreadAttachmentRPC round-trip.Affected Files
apps/web-ui/packages/client/ui-conversation/src/client/prepare-photo.tsapps/web-ui/packages/client/ui-conversation/src/client/conversation/historical-images.tsapps/web-ui/packages/client/ui-conversation/src/client/conversation/assembly.tsapps/web-ui/packages/client/ui-conversation/src/client/service.tsapps/web-ui/packages/client/ui-conversation/test/prepare-photo.test.tsapps/web-ui/packages/client/ui-conversation/test/historical-images.test.tsUI / Visual Impact
No visual changes: client-side upload compression and in-memory image preview LRU caching only; no layout, styling, or component visual changes.
Validation
npx vitest run --config tests/vitest.config.js apps/web-ui/packages/client/ui-conversation/test/— 8 test files, 33 tests passed (including 11 new tests inprepare-photo.test.tsandhistorical-images.test.ts, re-run after formatting)npx tsc --noEmit -p apps/web-ui/tsconfig.json— passednpm run build:web:ui— passed (built all 43 client plugins and Web bundle)npx prettier --checkon all 6 changed/added files — passed