Provide a way to prevent creating duplicate infobars via notificationbox.js
Categories
(Toolkit :: UI Widgets, enhancement)
Tracking
()
People
(Reporter: hjones, Unassigned)
References
Details
(Whiteboard: [recomp])
Currently when we want to prevent the creation of duplicate notifications we use getNotificationWithValue to do something like this:
// Don't create a second notification if one already exists.
if (notificationbox.getNotificationWithValue("foo")) {
return;
}
notificationbox.appendNotification became async via the work in Bug 1845150, which led to at least one instance where we started showing duplicates of the same notification. Because creation is happening asynchronously getNotificationWIthValue is no longer necessarily a reliable way of checking whether a notification has already been created, since it's possible to call appendNotification multiple times in quick succession before the initial notification gets added.
In order to make things more reliable and to provide an easier way of ensuring we avoid creating duplicate notifications we may want to start tracking pending notifications in notificationbox.js. :mstriemer suggested something like hasNotificationWithValue() to let consumers know that a notification is already being created, or possibly changing the return value of getNotificationWithValue() in cases where creation is pending.
Updated•1 year ago
|
Updated•1 year ago
|
Description
•