Pages corrections widget

This commit is contained in:
alma 2026-01-16 17:25:46 +01:00
parent ed9dadd77a
commit b6bb7b61ad

View File

@ -228,32 +228,30 @@ export function Email() {
items: notificationItems,
});
// Dispatch event for Outlook-style notifications (for new emails detected by ID)
if (hasNewEmails) {
// Get only the newly arrived emails (by ID comparison)
const newEmails = transformedEmails
.filter(e => newEmailIds.has(e.id) && !e.read)
.slice(0, 5); // Limit to 5 most recent new emails
// Dispatch event for Outlook-style notifications (for new emails detected by ID)
if (hasNewEmails) {
// Get only the newly arrived emails (by ID comparison)
const newEmails = transformedEmails
.filter(e => newEmailIds.has(e.id) && !e.read)
.slice(0, 5); // Limit to 5 most recent new emails
if (newEmails.length > 0) {
console.log('[Email Widget] 📧 Dispatching new emails event', {
newEmailsCount: newEmails.length,
newEmailIds: Array.from(newEmailIds),
previousCount: lastUnreadCountRef.current,
currentCount: currentUnreadCount,
previousEmailIds: Array.from(lastEmailIdsRef.current),
});
if (newEmails.length > 0) {
console.log('[Email Widget] 📧 Dispatching new emails event', {
newEmailsCount: newEmails.length,
newEmailIds: Array.from(newEmailIds),
previousCount,
currentCount: currentUnreadCount,
previousEmailIds: Array.from(lastEmailIdsRef.current),
});
window.dispatchEvent(new CustomEvent('new-emails-detected', {
detail: {
emails: transformedEmails,
accountMap: accountMap,
previousCount,
currentCount: currentUnreadCount,
}
}));
window.dispatchEvent(new CustomEvent('new-emails-detected', {
detail: {
emails: transformedEmails,
accountMap: accountMap,
previousCount: lastUnreadCountRef.current,
currentCount: currentUnreadCount,
}
}
}));
}
}