Files
Zero/apps/server/src
Adam 5b2d76a5d4 prefetch email html (#1719)
# 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 -->
2025-07-11 15:57:19 -07:00
..
2025-07-11 15:57:19 -07:00
2025-07-11 11:30:08 -07:00
2025-07-10 10:59:40 -07:00
2025-07-10 10:59:40 -07:00
2025-06-17 15:37:12 -07:00
2025-07-11 14:29:06 -07:00
2025-05-23 19:20:17 +05:30
2025-07-11 11:30:08 -07:00
2025-07-09 13:42:03 -07:00
2025-07-09 13:42:03 -07:00