I’m going through an issue with the hierarchy listView. I have a 543 element listView that generates around 2200 of these:
[Violation] Added non-passive event listener to a scroll-blocking ‘touchstart’ event. Consider marking event handler as ‘passive’ to make the page more responsive.
While I don’t think this if affecting anything, I’m wondering if there’s anything I can do to fix this?
These warnings appear because this type of event listener can potentially cause performance issues - but this doesn’t mean that they are. In our case we cannot use passive event listeners, because we’re conditionally prevent page scroll, and this cannot be done with passive event listeners. E.g. in the case of the listview in the
touchmove event we’re checking if the horizontal movement is larger than a threshold, we start swiping the listview item, and blocking the page scroll.
However in the case of the listview only 2 warnings should appear (for one listview). I guess those few thousend warnings gathered while using the app for a while, including other components. E.g. if you use a rangepicker, it will display ~50 warnings like this, every time it’s opened.
Let me know if this explains!
Those warnings happen all at once when initializing the app. I have 2 listViews, probably 5 numpads and a calendar datepicker and date range picker. It seems like a lot of warnings.
Mobiscroll should not cause that many warnings right on initialization. Could you please try removing the mobiscroll initializations temporary, and see if the warnings are still present or not?
Without initializing the listview there are only 100 warnings.
This does not sound right. Could you please check how many times does the listview initialization run? E.g. put a
console.log near the listview initialization, and see how many times it’s getting called. One listview initialization only adds one touchstart and one touchmove listener, so it should cause only 2 warnings like this.