question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onPositionChange, onEnter and onLeave fire once on page load, and won't fire again until reload

See original GitHub issue

I am using Waypoint to track whether a header has left the top of the viewport.

When a page is loaded (using Gatsbyjs’s wrapper for react-router’s Link component) onPositionChange, onEnter and onLeave are all fired at once (checked by using them to log a string to console), and then are never fired again when the page is scrolled. They are only fired again when I navigate to a different page, and they all fire at once again and the process repeats.

The debug output shows that waypoints of the child div are being tracked, and correctly identify when the div has left the viewport.

Despite this, none of the functions are triggering on scroll - I’m not sure if this is connected to react-router similar to #249

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
alfred-pbcommented, Feb 19, 2020

I had a similar issue and the issue was coming from the gatsby-plugin-transition-link The plugin was adding an overflow-x:hidden, adding this to my styles fixed the issue.

.tl-edges {
  overflow-x: initial;
}
2reactions
ehubbellcommented, Feb 10, 2021

I’m experiencing the same issue above with Gatsby. If I wrap a block or place the following element in any of my components, every hook fires on initial page load and then nothing. Debug shows all the output as expected.

  <Waypoint 
    scrollableAncestor='window' 
    onPositionChange={console.log("changed")} 
    onEnter={console.log("enter")} 
    onLeave={console.log("leave")}
/>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Timer will not fire "onclick". Fires on page load - Stack Overflow
Reset the timer so that you can click on the button to start the timer again; Prevent the timer being started again (which...
Read more >
brigade - Bountysource
onPositionChange, onEnter and onLeave fire once on page load, and won't fire ... a different page, and they all fire at once again...
Read more >
Onchange event on the field fires on the page load
Here is an example, using onload to check if the fields were changed from the UI. The change will not register the button...
Read more >
Instrumentation Components Release Notes - Support
fire. 4. Added Support for CodeGear Delphi & C++ Builder 2009. 5. Added CustomizeLabelEventText property to the PlotAxis object. This new.
Read more >
@elastic/eui | Yarn - Package Manager
Enhanced EuiSuggest to fire the onItemClick callback on Enter key press as ... for EuiColorPicker onBlur and onFocus callbacks (#1993); Fixed EuiIcon again...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found