Safari desktop triggers endless loop
See original GitHub issueHi!
I’m using inView
to detect if a container is in view, then setting this property to a secondary container that should be visible when the first one is out of view.
In Chrome this works fine, but in Safari I’m getting a endless loop of inView
being toggled between true
and false
when my scroll position is at the edge of the intersection point.
Any help with this?
const [primaryContainerRef, inView] = useInView();
<div className="primary-container" ref={primaryContainerRef}>
This is the primary container
</div>
<SecondaryContainer isVisible={!inView} />
const SecondaryContainer = ({ isVisible }) => {
return (
{isVisible && (
<div className="secondary-container">This is the secondary container</div>
)}
)
};
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:17 (7 by maintainers)
Top Results From Across the Web
Web page in Safari is and endless loop - … - Apple Community
Web page in Safari is and endless loop - how can I stop it · 1. Kill Safari if it's running. · 2....
Read more >google ads enableLazyLoad causes endless loop on safari ...
This works fine on chrome, firefox and edge. However on safari and IE it causes an endless loop which freezes the page. I'm...
Read more >Teams App and Browser stuck in an endless loop
It yet again opened with an unresponsive white screen and triggered the endless loop of opening a new tab with meeting options and...
Read more >Firefox and Safari: endless loop with 'toUnifiedPlan'?
This seems to be caused by the “toUnifiedPlan” method. Using the profiling tools of the browser it seems to be triggered by “renegotiationneed”....
Read more >Trying to create endless loop macro (Repeat or For Each ...
How does CMD-Click trigger your macro? gglick January 21, 2020, 12:25am #22. ronald: When I changed by default browser to safari, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@thebuilder here you go: https://codesandbox.io/s/react-intersection-observer-p9ide
So another observation as I was making this demo: the order on the DOM is relevant. In my example, the flickering occurs only when the observer element is inserted above the element it’s observing. So for anyone coming across this issue, potential solutions:
position: fixed
is a better choice thanposition: sticky
position: sticky
all by itselfNot sure if this is exactly what’s going on in the original post, but I hope this helps. 😃
can confirm that 8.26.2 fixes the issue in chrome 80 (and 81)