Skip to content

Commit a277089

Browse files
committed
minor fixes
1 parent f21a934 commit a277089

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* WordPress dependencies
33
*/
4-
import { useRef } from '@wordpress/element'
4+
import { useRef, useEffect } from '@wordpress/element'
55

66
const NOOP = () => {}
77

@@ -96,6 +96,17 @@ export const useAutoScroll = ( hostRef, shadowBodySizeRef, selectedTab ) => {
9696
scrollPositionRef.current = -1
9797
}
9898

99+
// Cleanup any pending animation on unmount.
100+
useEffect( () => {
101+
return () => {
102+
if ( animationFrameRef.current ) {
103+
cancelAnimationFrame( animationFrameRef.current )
104+
animationFrameRef.current = null
105+
}
106+
scrollPositionRef.current = -1
107+
}
108+
}, [] )
109+
99110
const onMouseOver = selectedTab === 'patterns' ? NOOP : onMouseOverImpl
100111
const onMouseOut = selectedTab === 'patterns' ? NOOP : onMouseOutImpl
101112
const onMouseDown = selectedTab === 'patterns' ? NOOP : onMouseDownImpl

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ export const getAdditionalStylesForPreview = () => {
327327
styles += 'body.preview-pages { overflow-y: hidden; max-height: 1200px; }'
328328

329329
styles += '::-webkit-scrollbar { width: 0; }'
330+
styles += 'body.preview-pages { scrollbar-width: none; -ms-overflow-style: none; }'
330331

331332
// Make sure count up block numbers are visible
332333
styles += `.stk-block-count-up__text:not(.stk--count-up-active) { opacity: 1; }`

src/components/modal-design-library/modal.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,6 @@ export const ModalDesignLibrary = props => {
146146
value: 'pages',
147147
title: __( 'Pages', i18n ),
148148
},
149-
// {
150-
// value: 'design-system',
151-
// title: __( 'Design System', i18n ),
152-
// },
153-
// {
154-
// value: 'site-kits',
155-
// title: __( 'Site Kits', i18n ),
156-
// },
157149
] }
158150
value={ selectedTab }
159151
onChange={ setSelectedTab }

src/design-library/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const fetchDesignLibrary = async ( forceReset = false, version = '', type
2424
path: `/stackable/v2/design_library/${ type }${ forceReset ? '/reset' : '' }`,
2525
method: 'GET',
2626
} )
27-
const designsPerType = await results
27+
const designsPerType = results
2828

2929
designLibrary[ type ] = designsPerType
3030

0 commit comments

Comments
 (0)