Skip to content

Resolve "Browser Notification request modal reacting unexpectedly"

Differences between local and staging

(Your experiences may differ) For me I was only seeing the alert appear twice when testing locally, whereas on staging it appears three times. As such I wasn't able to determine where the third alert was coming from, and am not sure if this fix will work for all three on staging. If anyone is able to reproduce the three alerts locally let me know 🙂

About the issue

Within the scheduled notification service, in the setup funciton, we have two separate calls to deferredPushSubscriptionUpdate (which in turn calls renewPushSubscription > rccPushNotificationService.getSubscription > askPermission

The first one is subcribed to getVapidPublicKey, and the second is subscribed to notificationControl.valueChanges. As they both get called at a similar time on the app startup, the alert shows up twice.

About the solution

Within the push notification service, I added logic to check whether or not the alert is already being shown, and if so, it should wait until it was resolved instead of opening its own alert

Why this might not work on staging

This currently works, because both calls to getSubscription are being fired from the same service instance. As on staging there's a third alert being triggered, and I'm not sure where from, it's possible it's being fired from another service instance. If this is the case, we'd need to adjust the push notification service so that it's a singleton, so they can share state, however I didn't want to do that if it's not necessary.

As such, if merged, this should be testing on staging as well

Closes #921 (closed)

Merge request reports

Loading