File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/ui/components/pages/Home/ChannelRenderer/ChannelVideos Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1- import React from 'react' ;
1+ import React , { useEffect , useRef } from 'react' ;
22import { Box , Grid } from '@mui/material' ;
33import { HomeView , Video } from 'types' ;
44import VideoCard from './VideoCard' ;
@@ -29,8 +29,16 @@ function ChannelVideos(props: ChannelVideosProps) {
2929 onVideoPlay,
3030 onLoadMore,
3131 } = props ;
32+ const showSkeletons = useRef ( true ) ;
3233 const skeletonNumber = Math . min ( maxResults - videos . length , itemsPerRow ) ;
3334
35+ useEffect ( ( ) => {
36+ if ( ! isLoading ) {
37+ showSkeletons . current = hasMore ?? true ;
38+ }
39+ // eslint-disable-next-line react-hooks/exhaustive-deps
40+ } , [ isLoading ] ) ;
41+
3442 return (
3543 < Box sx = { { display : 'flex' , pl : 6 } } >
3644 < Grid container spacing = { config . gridSpacing } columns = { config . gridColumns } >
@@ -39,7 +47,7 @@ function ChannelVideos(props: ChannelVideosProps) {
3947 < VideoCard video = { video } view = { view } onVideoPlay = { onVideoPlay } />
4048 </ GridItem >
4149 ) ) }
42- { isLoading && hasMore && skeletonNumber > 0
50+ { isLoading && showSkeletons . current && skeletonNumber > 0
4351 ? Array . from ( new Array ( skeletonNumber ) ) . map ( ( _ , index : number ) => (
4452 < GridItem key = { index } >
4553 < VideoSkeleton />
You can’t perform that action at this time.
0 commit comments