diff --git a/components/ClientEmailSection.vue b/components/ClientEmailSection.vue index e635f02..6001974 100644 --- a/components/ClientEmailSection.vue +++ b/components/ClientEmailSection.vue @@ -75,8 +75,14 @@ + +
+ +
Loading email history...
+
+ -
+
Email History diff --git a/server/api/email/fetch-thread.ts b/server/api/email/fetch-thread.ts index 7f80edc..af97bda 100644 --- a/server/api/email/fetch-thread.ts +++ b/server/api/email/fetch-thread.ts @@ -24,8 +24,8 @@ export default defineEventHandler(async (event) => { try { const body = await readBody(event); - // Limit emails to improve performance - const { clientEmail, interestId, sessionId, limit = 20 } = body; + // Limit IMAP emails but load all cached emails + const { clientEmail, interestId, sessionId, limit = 50 } = body; if (!clientEmail || !sessionId) { throw createError({ @@ -84,13 +84,10 @@ export default defineEventHandler(async (event) => { console.log('Found cached email files:', files.length); - // Limit cached emails to most recent ones - const sortedFiles = files - .filter(f => f.name.endsWith('.json')) - .sort((a, b) => b.name.localeCompare(a.name)) // Sort by filename (newer files have higher timestamps) - .slice(0, limit); // Only load up to the limit + // Load ALL cached emails (no limit) - just filter JSON files + const jsonFiles = files.filter(f => f.name.endsWith('.json')); - for (const file of sortedFiles) { + for (const file of jsonFiles) { try { // Read file directly on server using MinIO client (works with private buckets) const client = getMinioClient();