Fix memory leak, notification badge not showing

This commit is contained in:
Jon Staab
2026-01-06 16:52:15 -08:00
parent 7f8744725c
commit d416fe913e
2 changed files with 21 additions and 13 deletions
@@ -23,16 +23,16 @@
}
}
$effect(() => {
if ($notifications.size > notificationCount) {
playSound()
}
notificationCount = $notifications.size
})
onMount(() => {
audioElement.load()
notifications.subscribe(notifications => {
if (notifications.size > notificationCount) {
playSound()
}
notificationCount = notifications.size
})
})
</script>
+13 -5
View File
@@ -5,7 +5,15 @@ import {pubkey, tracker, repository, relaysByUrl} from "@welshman/app"
import {prop, find, call, spec, first, identity, now, groupBy} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util"
import {deriveEventsByIdByUrl} from "@welshman/store"
import {ZAP_GOAL, EVENT_TIME, MESSAGE, THREAD, COMMENT, getTagValue} from "@welshman/util"
import {
ZAP_GOAL,
EVENT_TIME,
MESSAGE,
THREAD,
COMMENT,
getTagValue,
sortEventsDesc,
} from "@welshman/util"
import {
makeSpacePath,
makeChatPath,
@@ -111,10 +119,10 @@ export const notifications = call(() => {
const threadPath = makeThreadPath(url)
const calendarPath = makeCalendarPath(url)
const messagesPath = makeSpaceChatPath(url)
const goalComments = goalCommentsByUrl.get(url)?.values() || []
const threadComments = threadCommentsByUrl.get(url)?.values() || []
const calendarComments = calendarCommentsByUrl.get(url)?.values() || []
const messages = messagesByUrl.get(url)?.values() || []
const goalComments = sortEventsDesc(goalCommentsByUrl.get(url)?.values() || [])
const threadComments = sortEventsDesc(threadCommentsByUrl.get(url)?.values() || [])
const calendarComments = sortEventsDesc(calendarCommentsByUrl.get(url)?.values() || [])
const messages = sortEventsDesc(messagesByUrl.get(url)?.values() || [])
const commentsByGoalId = groupBy(
e => getTagValue("E", e.tags),