1

In a Meteor app I get the following error:

Tracker.afterFlush: t.document.querySelector(...) is null

In my app, sometimes there is no match and it is normal.

So why would Tracker.afterFlush even warn me of this and how could I get rid of this error ?

MickaelFM
  • 897
  • 1
  • 8
  • 19
  • By only doing things with the element when it exists, e.g.: `if (document.querySelector(...) { // Do something }` Otherwise it will throw an error as you can't do `null.style.backgroundColor = 'red'` for example. – Daan Jun 03 '20 at 11:27

1 Answers1

0

I pinpointed the error. It's coming from a library I use that does not check if the queried element exists or not. So I check it myself before using it.

  if(document.querySelector('#list')) {
    Split(['#list', '#itemView']);
  }
MickaelFM
  • 897
  • 1
  • 8
  • 19