Skip to content
This repository was archived by the owner on Jul 22, 2020. It is now read-only.

Comments

Don't leak event listeners in the silence form#82

Merged
prymitive merged 1 commit intomasterfrom
event-listener-leak
Apr 27, 2017
Merged

Don't leak event listeners in the silence form#82
prymitive merged 1 commit intomasterfrom
event-listener-leak

Conversation

@prymitive
Copy link
Contributor

Event listeners are setup on the modal div, but that div is not removed when the modal is hidden, only its children. This means that event listeners are stacked every time you show and hide a form. To reproduce this issue:

  1. open silence form, click up button above hours, it will increment from 1 to 2
  2. hide the form
  3. re-open silence form, click up button above hours, it will increment from 1 to 3
  4. repeat and every time increment will get a new listener that will cause higher value bump

This PR moves all listeners to the silence form element, which is removed when modal is closed, so all even listeners are destroyed properly and this bug no longer gets triggered.
Same fix is applied to the quick filter modal, it's present there but the effect there isn't as visible

Event listeners are setup on the modal div, but that div is not removed when the modal is hidden, only its children. This means that event listeners are stacked every time you show and hide a form. To reproduce this issue:
1. open silence form, click up button above hours, it will increment from 1 to 2
2. hide the form
3. re-open silence form, click up button above hours, it will increment from 1 to 3
4. repeat and every time increment will get a new listener that will cause higher value bump

This PR moves all listeners to the silence form element, which is removed when modal is closed, so all even listeners are destroyed properly and this bug no longer gets triggered.
Same fix is applied to the quick filter modal, it's present there but the effect there isn't as visible
@prymitive prymitive merged commit 106175b into master Apr 27, 2017
@prymitive prymitive deleted the event-listener-leak branch April 27, 2017 01:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants