Skip to content

Commit 55a9c56

Browse files
committed
Fixed duplication of desktop notifications on server data reception
1 parent bf33f23 commit 55a9c56

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/[locale]/components/notification.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default function Notifications()
7272
setLoading( false );
7373

7474
// Vérification de l'existence de l'API de notifications.
75-
if ( typeof Notification !== "undefined" )
75+
if ( typeof Notification !== "undefined" && filter.length > 0 )
7676
{
7777
// Demande de permission pour les notifications.
7878
const icon: HTMLLinkElement | null =
@@ -86,10 +86,12 @@ export default function Notifications()
8686
data.forEach( ( notification ) =>
8787
{
8888
const popup = new Notification(
89-
document.title,
89+
"Simple File Storage",
9090
{
9191
icon: icon?.href,
92-
body: notification.title
92+
body: modalMessages(
93+
`description_${ notification.title }`
94+
)
9395
}
9496
);
9597

@@ -117,7 +119,7 @@ export default function Notifications()
117119
.slice( 0, MAX_NOTIFICATIONS );
118120
} );
119121
} );
120-
}, [ router ] );
122+
}, [ modalMessages, router ] );
121123

122124
// Soumission de la requête de marquage de toutes les notifications comme lues.
123125
const submitClearing = async () =>

0 commit comments

Comments
 (0)