Skip to content

Commit ea23da2

Browse files
authored
Fix incorrect polling start (#466)
1 parent 5cb7947 commit ea23da2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

vertical-collection/addon/-private/data-view/utils/scroll-handler.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,14 @@ export class ScrollHandler {
5050
}
5151

5252
// TODO add explicit test
53-
if (this.isUsingPassive && handlers.length === 1) {
54-
element.addEventListener('scroll', cache.passiveHandler, {
55-
capture: true,
56-
passive: true,
57-
});
53+
if (this.isUsingPassive) {
54+
// Only add the event listener once, if more handlers are present.
55+
if (handlers.length === 1) {
56+
element.addEventListener('scroll', cache.passiveHandler, {
57+
capture: true,
58+
passive: true,
59+
});
60+
}
5861

5962
// TODO add explicit test
6063
} else if (!this.isPolling) {

0 commit comments

Comments
 (0)