@@ -150,20 +150,6 @@ export class MainWindow extends React.Component<IProps, IMainWindowState> {
150
150
} ;
151
151
152
152
this . applicationButtons = [ ] ;
153
-
154
- this . props . api . events . on ( 'show-main-page' , pageId => {
155
- this . setMainPage ( pageId , false ) ;
156
- } ) ;
157
-
158
- this . props . api . events . on ( 'refresh-main-page' , ( ) => {
159
- this . forceUpdate ( ) ;
160
- } ) ;
161
-
162
- this . props . api . events . on ( 'show-modal' , id => {
163
- this . updateState ( {
164
- showLayer : { $set : id } ,
165
- } ) ;
166
- } ) ;
167
153
}
168
154
169
155
public getChildContext ( ) : IComponentContext {
@@ -183,6 +169,20 @@ export class MainWindow extends React.Component<IProps, IMainWindowState> {
183
169
184
170
this . updateSize ( ) ;
185
171
172
+ this . props . api . events . on ( 'show-main-page' , pageId => {
173
+ this . setMainPage ( pageId , false ) ;
174
+ } ) ;
175
+
176
+ this . props . api . events . on ( 'refresh-main-page' , ( ) => {
177
+ this . forceUpdate ( ) ;
178
+ } ) ;
179
+
180
+ this . props . api . events . on ( 'show-modal' , id => {
181
+ this . updateState ( {
182
+ showLayer : { $set : id } ,
183
+ } ) ;
184
+ } ) ;
185
+
186
186
window . addEventListener ( 'resize' , this . updateSize ) ;
187
187
window . addEventListener ( 'keydown' , this . updateModifiers ) ;
188
188
window . addEventListener ( 'keyup' , this . updateModifiers ) ;
@@ -191,6 +191,9 @@ export class MainWindow extends React.Component<IProps, IMainWindowState> {
191
191
}
192
192
193
193
public componentWillUnmount ( ) {
194
+ this . props . api . events . removeAllListeners ( 'show-main-page' ) ;
195
+ this . props . api . events . removeAllListeners ( 'refresh-main-page' ) ;
196
+ this . props . api . events . removeAllListeners ( 'show-modal' ) ;
194
197
window . removeEventListener ( 'resize' , this . updateSize ) ;
195
198
window . removeEventListener ( 'keydown' , this . updateModifiers ) ;
196
199
window . removeEventListener ( 'keyup' , this . updateModifiers ) ;
@@ -436,7 +439,7 @@ export class MainWindow extends React.Component<IProps, IMainWindowState> {
436
439
const state = this . props . api . getState ( ) ;
437
440
const profile = profileById ( state , this . props . activeProfileId ) ;
438
441
const game = profile !== undefined ? getGame ( profile . gameId ) : undefined ;
439
- const gameName = game ?. name || 'Mods' ;
442
+ const gameName = game ?. shortName || game ?. name || 'Mods' ;
440
443
const pageGroups = [
441
444
{ title : undefined , key : 'dashboard' } ,
442
445
{ title : 'General' , key : 'global' } ,
0 commit comments