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();