Skip to content

Commit 0056a64

Browse files
committed
increase debounce to tune loader
1 parent 4c4d20e commit 0056a64

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/components/react/Gallery.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,12 @@ const Gallery: FC<Props> = ({ images }) => {
126126
</div>
127127

128128
{/* control threshold with margin-top */}
129+
{/* must be on top so loader doesn't affect it */}
129130
<div ref={observerTarget} className="mt-0" />
130131

131132
<div
132133
className={cn(
134+
// duration-500 is related to OBSERVER_DEBOUNCE: 300
133135
'flex items-center justify-center transition-all duration-500 ease-in-out',
134136
shouldShowLoader ? 'min-h-48' : 'min-h-0'
135137
)}

src/constants/gallery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ export const GALLERY = {
88
/** page dependency in useEffect is more important */
99
INITIAL_PAGE: 1,
1010
/** fine tuned for scroll */
11-
OBSERVER_DEBOUNCE: 150,
11+
OBSERVER_DEBOUNCE: 300,
1212
} as const;

0 commit comments

Comments
 (0)