@@ -10,6 +10,7 @@ import {
1010 useRef ,
1111 useState ,
1212} from 'react' ;
13+ import { views } from 'store/reducers/settings' ;
1314import { GetChannelVideosResponse } from 'store/services/youtube' ;
1415import { Channel , Video , HomeView } from 'types' ;
1516
@@ -32,9 +33,7 @@ type ChannelVideosContextType = {
3233 ) => Video | undefined ;
3334} ;
3435
35- const ALL_VIEWS = Object . values ( HomeView ) ;
36-
37- const INITIAL_COUNT = ALL_VIEWS . reduce (
36+ const initialVideosCount = views . reduce (
3837 ( acc , view ) => ( {
3938 ...acc ,
4039 [ view ] : {
@@ -45,7 +44,7 @@ const INITIAL_COUNT = ALL_VIEWS.reduce(
4544 { } ,
4645) ;
4746
48- const INITIAL_MAP = ALL_VIEWS . reduce (
47+ const initialChannelsMap = views . reduce (
4948 ( acc , view ) => ( { ...acc , [ view ] : new Map ( ) } ) ,
5049 { } ,
5150) ;
@@ -56,9 +55,9 @@ const ChannelVideosContext = createContext<
5655
5756export const ChannelVideosProvider : FC = memo ( ( { children } ) => {
5857 const [ videosCount , setVideosCount ] =
59- useState < ChannelVideosContextType [ 'videosCount' ] > ( INITIAL_COUNT ) ;
58+ useState < ChannelVideosContextType [ 'videosCount' ] > ( initialVideosCount ) ;
6059 const channelsMap = useRef < { [ key : string ] : Map < string , ChannelData > } > (
61- INITIAL_MAP ,
60+ initialChannelsMap ,
6261 ) ;
6362
6463 const updateCount = useCallback (
0 commit comments