@@ -64,13 +64,13 @@ export class SelectedTab {
64
64
export class DomainState {
65
65
66
66
private _networkSet : NetworkSetDomain ;
67
- private _latestCurrentTab : SelectedTab ;
67
+ private _latestCurrentTab : SelectedTab | void ;
68
68
private _currentTab : Rx . Observable < SelectedTab > ;
69
69
private _notifiableMessage : Rx . Observable < RecievedMessage > ;
70
70
71
71
constructor ( gateway : MessageGateway ) {
72
72
this . _networkSet = new NetworkSetDomain ( gateway ) ;
73
- this . _latestCurrentTab = null ;
73
+ this . _latestCurrentTab = undefined ;
74
74
75
75
// In most of case, a rendering operation is depend on the source of `selectTab()`.
76
76
// So this observable should be on the next event loop.
@@ -79,18 +79,18 @@ export class DomainState {
79
79
} ) . observeOn ( Rx . Scheduler . asap ) . share ( ) ;
80
80
81
81
this . _notifiableMessage = this . _networkSet . recievedNotifiableMessage ( )
82
- . withLatestFrom ( this . _currentTab , function ( data , current ) : RecievedMessage {
82
+ . withLatestFrom ( this . _currentTab , function ( data , current ) : RecievedMessage | void {
83
83
const isSameChannel : boolean = current . channelId . mapOr ( false , function ( current : ChannelId ) {
84
84
return data . channelId === current ;
85
85
} ) ;
86
86
if ( isSameChannel ) {
87
- return null ;
87
+ return undefined ;
88
88
}
89
89
90
90
return data ;
91
91
} ) . filter ( function ( data ) {
92
- return data !== null ;
93
- } ) . share ( ) ;
92
+ return data !== undefined ;
93
+ } ) . map ( ( data ) => data ! ) . share ( ) ;
94
94
}
95
95
96
96
/**
@@ -100,7 +100,7 @@ export class DomainState {
100
100
return this . _networkSet . legacy ;
101
101
}
102
102
103
- get currentTab ( ) : SelectedTab {
103
+ get currentTab ( ) : SelectedTab | void {
104
104
return this . _latestCurrentTab ;
105
105
}
106
106
@@ -155,7 +155,7 @@ function selectTab(gateway: MessageGateway, intent: UIActionDispatcher, set: Net
155
155
} ) ;
156
156
157
157
const removedNetwork = set . removedNetwork ( ) . withLatestFrom ( set . getNetworkList ( ) , function ( _ , list ) {
158
- let tab : SelectedTab = null ;
158
+ let tab : SelectedTab ;
159
159
if ( list . length === 0 ) {
160
160
tab = new SelectedTab ( CurrentTabType . SETTING , 'connect' ) ;
161
161
}
@@ -183,7 +183,7 @@ function selectTab(gateway: MessageGateway, intent: UIActionDispatcher, set: Net
183
183
} ) ;
184
184
185
185
const initial = set . initialState ( ) . map ( function ( data ) {
186
- let tab : SelectedTab = null ;
186
+ let tab : SelectedTab ;
187
187
188
188
const idIsSetting = data . active . mapOr ( true , function ( id ) {
189
189
return ( typeof id !== 'number' ) ;
0 commit comments