Monaca Onsen UI Discord Chat Github Repo

Cannot read property 'removeEventListener' of null - Error explantation.



  • I was getting two errors:

    1. "Cannot read property ‘removeEventListener’ of null "

    2. and then “pushPage is already running” (broke navigation).

    With some digging I found sort of an obscure post that mentioned “setTimeout”: https://community.onsen.io/topic/3303/uncaught-in-promise-pushpage-is-already-running/2

    I gave it a go and inserted a setTimeout to my function and everything works now. See below:

    function editItem(getName, getDetails) {
      document.querySelector('#myNavigator').pushPage('page4.html').then(setTimeout (function(){
        var noteName = document.getElementById('note-name');
        var noteDetails = document.getElementById('note-details');
        noteName.innerHTML = getName;
        noteDetails.innerHTML = getDetails;
      }), 5000);
    }
    

    Now it seems to work better. However, after a couple of clicks I get the errors again. Can anybody lead me in the right direction so I can research this better. Thanks.