Skip to content

Commit 6b5f3df

Browse files
committed
use double rAF
1 parent 767eb63 commit 6b5f3df

File tree

1 file changed

+4
-1
lines changed
  • src/components/design-library-list

1 file changed

+4
-1
lines changed

src/components/design-library-list/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ const DesignLibraryItem = props => {
115115
}
116116

117117
const observer = new IntersectionObserver( ( [ entry ] ) => {
118-
setShouldRender( entry.isIntersecting )
118+
// reduce flicker during rapid scrolls
119+
requestAnimationFrame( () => {
120+
requestAnimationFrame( () => setShouldRender( entry.isIntersecting ) )
121+
} )
119122
}, {
120123
root: rootEl,
121124
rootMargin: '250px',

0 commit comments

Comments
 (0)