1
1
import React , { useEffect } from 'react' ;
2
- import { observable , ObservableMap , values } from 'mobx' ;
2
+ import { observable } from 'mobx' ;
3
+ import { lndListChannelsMany } from 'util/tests/sampleData' ;
3
4
import { useStore } from 'store' ;
4
5
import { Channel } from 'store/models' ;
5
6
import { Layout } from 'components/layout' ;
@@ -11,35 +12,23 @@ export default {
11
12
parameters : { contained : true } ,
12
13
} ;
13
14
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 /> ;
22
17
} ;
23
18
24
- export const Default = ( ) => {
25
- const { channelStore } = useStore ( ) ;
19
+ export const ManyChannels = ( ) => {
20
+ const store = useStore ( ) ;
26
21
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
+ } ) ;
31
28
return < LoopPage /> ;
32
29
} ;
33
30
34
- export const ManyChannels = ( ) => < LoopPage /> ;
35
-
36
31
export 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
-
43
32
return (
44
33
< Layout >
45
34
< LoopPage />
0 commit comments