refactor: simplify notifications update

This commit is contained in:
tglide committed 2023-03-21 12:43:33 +00:00
1 parent d3f4cb2dea
commit e2d2c43a82
1 file changed
+1 -5
+1 -5
View File
@@ -33,11 +33,7 @@ export const addNotification = (notification: Omit<Notification, 'id'>) => {
const n = { ...defaults, ...notification };
notifications.update((all) => {
if (all.length < 3) {
return [n, ...all];
} else {
return [n, ...all.slice(0, 2)];
}
return [n, ...all.slice(0, 2)];
});
if (n.timeout) setTimeout(() => dismissNotification(n.id), n.timeout);