Skip to content

Commit 836345c

Browse files
authored
fix(inbox): size indicator not updating on item deletion (@byseif21) (monkeytypegame#6649)
### Description Closes monkeytypegame#6648
1 parent cfff712 commit 836345c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

frontend/src/ts/db.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,14 @@ export function addXp(xp: number): void {
993993
setSnapshot(snapshot);
994994
}
995995

996+
export function updateInboxUnreadSize(newSize: number): void {
997+
const snapshot = getSnapshot();
998+
if (!snapshot) return;
999+
1000+
snapshot.inboxUnreadSize = newSize;
1001+
setSnapshot(snapshot);
1002+
}
1003+
9961004
export function addBadge(badge: Badge): void {
9971005
const snapshot = getSnapshot();
9981006
if (!snapshot) return;

frontend/src/ts/elements/alerts.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const state: State = {
2929

3030
function hide(): void {
3131
setNotificationBubbleVisible(false);
32+
DB.updateInboxUnreadSize(0);
3233
void modal.hide({
3334
afterAnimation: async () => {
3435
$("#alertsPopup .notificationHistory .list").empty();
@@ -301,8 +302,9 @@ export function setNotificationBubbleVisible(tf: boolean): void {
301302
}
302303

303304
function updateInboxSize(): void {
305+
const remainingItems = accountAlerts.length - mailToDelete.length;
304306
$("#alertsPopup .accountAlerts .title .right").text(
305-
`${accountAlerts.length}/${maxMail}`
307+
`${remainingItems}/${maxMail}`
306308
);
307309
}
308310

0 commit comments

Comments
 (0)