bootstrap-notify icon indicating copy to clipboard operation
bootstrap-notify copied to clipboard

Duplicate Notifications After Consequent AJAX Calls

Open monsieur-ricky opened this issue 8 years ago • 7 comments

Hi,

I'm using the most recent release of Bootstrap Notify (v3.1.5) to show status messages after an AJAX call. It works as expected in the first call. After the first execution, every time the notify is called, its shows the previous notifications message. Example:

  • 1st call = 1 Notify message;
  • 2nd call = 2 Notify messages;
  • 3rd call = 3 Notify messages;

How can i solve this issue?

$.notify({ icon: icon, title: title, message: message }, { type: type, allow_dismiss: true, newest_on_top: false, placement: { from: "top", align: "right" }, offset: 20, spacing: 10, z_index: 100000, delay: delay, timer: 1000, mouse_over: true, animate: { enter: 'animated fadeInDown', exit: 'animated fadeOutUp' } });

monsieur-ricky avatar Jan 28 '17 13:01 monsieur-ricky

I am getting the similar issue. Notification gets doubled on every call.

GuruWithin avatar Apr 27 '17 04:04 GuruWithin

I am also experiencing the same issue

adrox37 avatar May 05 '17 14:05 adrox37

Same exact issue I'm having. Is there a fix or an answer to how to use this plugin in this scenario? I have noticed that if i refresh the page, the issue doesn't raise it's ugly head, but it's not the way I want to do this!

bwhitley avatar Jun 01 '17 05:06 bwhitley

Sorry to flood with comments about this issue, but I would really like to use this! However, I cannot figure out a solution to this problem. I'm having the same issue that ricky2k7 originally commented on. Please, please let me (us) know if this is a bug, if there is a workaround, etc.

bwhitley avatar Jun 02 '17 03:06 bwhitley

Can someone send me an example of this issue. I am not able to replicate it, sorry.

mouse0270 avatar Jun 02 '17 12:06 mouse0270

I finally solved my issue with this not too long after I posted my last comment. I've been a developer for over 20 years, but fairly new to the front-end world so I'm sure it was the way that I was using it.

I was generating a $.notify("...") within the success promise of my ajax calls and for some reason, on successive calls, the notification bubble would increase by one each time. I was debugging this issue and sure enough, if it was the third time, 3 events were getting fired.

What I did was pulled the $.notify("...") out from the promise and instead, called a method that then did a $.notify("..."). This fixed my issue, but I don't know why.

bwhitley avatar Jun 02 '17 13:06 bwhitley

For a more simple solution just add $.notifyClose(); before the $.notify() call. This is clear all the pending stacks and instantiates new.

GuruWithin avatar Jun 15 '17 07:06 GuruWithin