Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Dialogues/Friends.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export default function Friends({ user, load, reset, friend }: FriendsProps) {
tokensRef.on('value', tokensSubscriber);

// TODO: Disable? After 3 failed attempts, permission = 'blocked'
if (window.Notification?.permission === 'default')
// Also re-save on 'granted' in case the service worker was refreshed (e.g. version reset)
if (token && window.Notification?.permission !== 'denied')
tokensRef.once('value', snapshot => snapshot.child(token).exists() || saveFcmToken())
Comment on lines +108 to 110
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getFcmToken() can resolve with a falsy token (e.g. null) when Messaging can't provide one yet. In that case snapshot.child(token) will throw and break this effect. Guard against a missing token before calling .child(...) (and decide whether you want to call saveFcmToken() when token is missing).

Copilot uses AI. Check for mistakes.
})
.catch(error => {
Expand Down
Loading