Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 53405ff

Browse files
committed
Improve animation rest
1 parent 9e7cde0 commit 53405ff

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

containers/notifications/manager.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,18 @@ export default (setNotifications) => {
5757
];
5858
});
5959

60-
intervalIds[id] = expiration === -1 ? -1 : setTimeout(() => hideNotification(id), expiration);
60+
intervalIds[id] =
61+
expiration === -1
62+
? -1
63+
: setTimeout(() => {
64+
// If the page is hidden, don't hide the notification with an animation because they get stacked.
65+
// This is to solve e.g. offline notifications appearing when the page is hidden, and when you focus
66+
// the tab again, they would be visible for the animation out even if they happened a while ago.
67+
if (document.hidden) {
68+
return removeNotification(id);
69+
}
70+
hideNotification(id);
71+
}, expiration);
6172

6273
return id;
6374
};

0 commit comments

Comments
 (0)