Fixing Notification Services Across EventYay
In this Blog-Post, I will show you, the fixing of multiple notification messages getting sent on multiple clicks or display of multiple messages for a single response.
What Caused the Problem?
In our Open Event Frontend, We are using Ember Notify Services to inject notification across the web app to show the notifications. Due to improper error handling on the client side sometimes we get multiple notification messages for a single click or for a single action. As shown in this picture.
How Did we Tackle It ?
Since the following issue was long pertaining, I solved the issue by adding a unique ID to each notification injected through the webapp. Since a unique ID was associated with each notification message, A single notification was getting displayed on each and every action irrespective of number of clicks or number of actions called. If an actions caused two notification to be simultaneously triggered, One of them on the basis of ID is suppressed so that a unique and understandable notification get shown.
Code Snippet:
Before the changes:
.then(() => {
if (state === 'draft') {
this.notify.success(this.l10n.t('Your event has been published successfully.'));
} else {
this.notify.success(this.l10n.t('Your event has been unpublished.'));
}
After the changes:
this.notify.success(this.isNewInvite ? this.l10n.t('Role Invite sent successfully') : this.l10n.t('Role Invite updated successfully'), {
id: 'man_role'
});
})
.catch(() => {
this.notify.error(this.l10n.t('Oops something went wrong. Please try again'), {
id: 'man_role_error'
});
})
Pull Request : Open-Event-Frontend-3438
Issue : Open-Event-Frontend-3437
Tags :
OpenEvent, EventYay, Fossasia, Intern-2k19
You must be logged in to post a comment.