Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
addEventListeners piling up
-
So perhaps I am doing something wrong. I am observing that eventListeners are piling up. Here is my situation. I tap a button, which causes a pushPage to occur. In the new page, add an eventListener. Later, the page gets popped. If I pushPage to the page again, an additional eventListener is created. The old event listener isn’t removed when a page is removed from the DOM. I see this using Chrome Dev tools. My question: should Onsen do this for me, or am I expected to manage this myself?
-
I tried out your scenario in the playground but I was unable to replicate the problem. For me, the event listener is being removed on
pushPage
andpopPage
.Could you please provide a working example through https://onsen.io/playground ? From there you can export it to codepen.
Also what version of Onsen UI are you using?
-
@Michael-Redwine Are you using React 16? Could be related to this issue: https://github.com/facebook/react/issues/12141