We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6ce28c6 + a317a79 commit 3e7033cCopy full SHA for 3e7033c
src/waypoint.jsx
@@ -71,7 +71,14 @@ class TargetEventHandlers {
71
handleEvent(eventName, event) {
72
const { handlers } = this.getEventHandlers(eventName);
73
Object.keys(handlers).forEach(function(index) {
74
- handlers[index](event);
+ const handler = handlers[index];
75
+ if (handler) {
76
+ // We need to check for presence here because a handler function may
77
+ // cause later handlers to get removed. This can happen if you for
78
+ // instance have a waypoint that unmounts another waypoint as part of an
79
+ // onEnter/onLeave handler.
80
+ handler(event);
81
+ }
82
});
83
}
84
0 commit comments