mirror of
https://github.com/Mail-0/Zero.git
synced 2026-07-01 08:16:28 +00:00
# Email Content Prefetching and Processing Optimization ## Description This PR improves email loading performance by implementing prefetching and caching of processed email HTML content. It splits the email processing logic into two parts: 1. Server-side preprocessing that handles sanitization and structure 2. Client-side processing that applies theme-specific styling and image loading preferences The changes also add prefetching of the latest message in a thread to improve perceived loading speed when users open emails. --- ## Type of Change - [x] ⚡ Performance improvement - [x] 🎨 UI/UX improvement ## Areas Affected - [x] Email Integration (Gmail, IMAP, etc.) - [x] User Interface/Experience - [x] Performance Optimization ## Testing Done - [x] Manual testing performed - [x] Cross-browser testing (if UI changes) ## Checklist - [x] I have performed a self-review of my code - [x] My changes generate no new warnings - [x] My code follows the project's style guidelines ## Additional Notes The email processing logic has been refactored to: 1. Separate heavy sanitization work (which can be done once) from theme/preference application 2. Cache processed content with a 30-minute stale time and 1-hour garbage collection time 3. Respect user preferences for external image loading and trusted senders 4. Apply theme-specific styling based on user settings or system preference This should significantly improve the perceived performance when opening emails, especially for threads with complex HTML content. --- _By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Improved email thread view by displaying the latest non-draft message. * Enhanced email content processing to apply user settings and theme preferences, including external image loading and dark/light mode support. * **Bug Fixes** * More accurate handling of external images and theme styling in emails based on user preferences. * **Chores** * Updated internal configuration for local development environment. <!-- end of auto-generated comment: release notes by coderabbit.ai -->