Skip to content

Commit e8945f5

Browse files
committed
Merge branch 'fix/design-library-full-pages-scrolling' of https://github.com/gambitph/Stackable into fix/design-library-full-pages-scrolling
2 parents d6710d7 + f4c853a commit e8945f5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/design-library-list/use-auto-scroll.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/**
22
* WordPress dependencies
33
*/
4-
import { useRef, useEffect } from '@wordpress/element'
4+
import {
5+
useRef, useEffect, useCallback,
6+
} from '@wordpress/element'
57

68
const NOOP = () => {}
79

@@ -101,7 +103,7 @@ export const useAutoScroll = ( hostRef, shadowBodySizeRef, selectedTab ) => {
101103
}
102104
}
103105

104-
const onMouseDownImpl = () => {
106+
const onMouseDownImpl = useCallback( () => {
105107
// Stop auto-scrolling when user interacts
106108
isScrollingRef.current = false
107109
if ( animationFrameRef.current ) {
@@ -115,7 +117,7 @@ export const useAutoScroll = ( hostRef, shadowBodySizeRef, selectedTab ) => {
115117
delayTimeoutRef.current = null
116118
}
117119
scrollPositionRef.current = -1
118-
}
120+
}, [] )
119121

120122
// Cleanup any pending animation on unmount.
121123
useEffect( () => {

0 commit comments

Comments
 (0)