fix(notification-service): track latest section for batch summary
This commit is contained in:
1 parent
4ed1e47c32
commit
2050c0e8fd
1 file changed
+7
-1
@@ -23,6 +23,7 @@ interface NotificationServiceDependencies {
|
|||||||
interface BatchState {
|
interface BatchState {
|
||||||
count: number;
|
count: number;
|
||||||
timer: ReturnType<typeof setTimeout>;
|
timer: ReturnType<typeof setTimeout>;
|
||||||
|
/** Latest section observed during the window. Summary navigates here on click. */
|
||||||
section: SectionId;
|
section: SectionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,8 +101,13 @@ export function createNotificationService(deps: NotificationServiceDependencies)
|
|||||||
return;
|
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++;
|
existing.count++;
|
||||||
|
const nextSection = options.navigation?.section;
|
||||||
|
if (nextSection) {
|
||||||
|
existing.section = nextSection;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function flushBatch(key: string) {
|
function flushBatch(key: string) {
|
||||||
|
|||||||
Reference in new issue
Block a user