Skip to content

Commit 28c2167

Browse files
Ignore fresh waypoints in handleScroll
In the rare event that a Waypoint was created in the instance where a scroll value went from negative to 0, that Waypoint would be triggered because of its null triggerPoint + the combination of checks that occured during the scroll handler. This change explicitly ignores waypoints with null trigger points during scroll checks. Fresh waypoints will be checked anyway during the refresh that occurs as part of Waypoint instantiation.
1 parent 1d90d5b commit 28c2167

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/context.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@
115115

116116
for (var waypointKey in this.waypoints[axisKey]) {
117117
var waypoint = this.waypoints[axisKey][waypointKey]
118+
if (waypoint.triggerPoint === null) {
119+
continue
120+
}
118121
var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint
119122
var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint
120123
var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint

0 commit comments

Comments
 (0)