fix(notification-service): track latest section for batch summary

This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 22:50:09 -04:00
1 parent 4ed1e47c32
commit 2050c0e8fd
1 file changed
+7 -1
+7 -1
View File
@@ -23,6 +23,7 @@ interface NotificationServiceDependencies {
interface BatchState {
count: number;
timer: ReturnType<typeof setTimeout>;
/** Latest section observed during the window. Summary navigates here on click. */
section: SectionId;
}
@@ -100,8 +101,13 @@ export function createNotificationService(deps: NotificationServiceDependencies)
return;
}
// Accumulate -- do not fire individual notification
// Accumulate -- do not fire individual notification.
// Track the most recent section so the summary links to where the latest event happened.
existing.count++;
const nextSection = options.navigation?.section;
if (nextSection) {
existing.section = nextSection;
}
}
function flushBatch(key: string) {