11import React , { useEffect } from 'react' ;
2- import { observable , ObservableMap , values } from 'mobx' ;
2+ import { observable } from 'mobx' ;
3+ import { lndListChannelsMany } from 'util/tests/sampleData' ;
34import { useStore } from 'store' ;
45import { Channel } from 'store/models' ;
56import { Layout } from 'components/layout' ;
@@ -11,35 +12,23 @@ export default {
1112 parameters : { contained : true } ,
1213} ;
1314
14- const channelSubset = ( channels : ObservableMap < string , Channel > ) => {
15- const few = values ( channels )
16- . slice ( 0 , 20 )
17- . reduce ( ( result , c ) => {
18- result [ c . chanId ] = c ;
19- return result ;
20- } , { } as Record < string , Channel > ) ;
21- return observable . map ( few ) ;
15+ export const Default = ( ) => {
16+ return < LoopPage /> ;
2217} ;
2318
24- export const Default = ( ) => {
25- const { channelStore } = useStore ( ) ;
19+ export const ManyChannels = ( ) => {
20+ const store = useStore ( ) ;
2621 useEffect ( ( ) => {
27- // only use a small set of channels
28- channelStore . channels = channelSubset ( channelStore . channels ) ;
29- } , [ channelStore ] ) ;
30-
22+ store . channelStore . channels = observable . map ( ) ;
23+ lndListChannelsMany . channelsList . forEach ( c => {
24+ const chan = new Channel ( store , c ) ;
25+ store . channelStore . channels . set ( chan . chanId , chan ) ;
26+ } ) ;
27+ } ) ;
3128 return < LoopPage /> ;
3229} ;
3330
34- export const ManyChannels = ( ) => < LoopPage /> ;
35-
3631export const InsideLayout = ( ) => {
37- const { channelStore } = useStore ( ) ;
38- useEffect ( ( ) => {
39- // only use a small set of channels
40- channelStore . channels = channelSubset ( channelStore . channels ) ;
41- } , [ channelStore ] ) ;
42-
4332 return (
4433 < Layout >
4534 < LoopPage />
0 commit comments