File tree 2 files changed +13
-24
lines changed
2 files changed +13
-24
lines changed Original file line number Diff line number Diff line change @@ -638,18 +638,11 @@ ipcMain.handle(
638
638
639
639
/// IPC handlers begin here.
640
640
641
- ipcMain . handle ( 'checkGameUpdates' , async ( event , library ?: Runner ) => {
642
- switch ( library ) {
643
- case 'legendary' :
644
- return LegendaryLibrary . get ( ) . listUpdateableGames ( )
645
- case 'gog' :
646
- return GOGLibrary . get ( ) . listUpdateableGames ( )
647
- default :
648
- return [
649
- ...( await LegendaryLibrary . get ( ) . listUpdateableGames ( ) ) ,
650
- ...( await GOGLibrary . get ( ) . listUpdateableGames ( ) )
651
- ]
652
- }
641
+ ipcMain . handle ( 'checkGameUpdates' , async ( ) => {
642
+ return [
643
+ ...( await LegendaryLibrary . get ( ) . listUpdateableGames ( ) ) ,
644
+ ...( await GOGLibrary . get ( ) . listUpdateableGames ( ) )
645
+ ]
653
646
} )
654
647
655
648
ipcMain . handle ( 'getEpicGamesStatus' , async ( ) => isEpicServiceOffline ( ) )
Original file line number Diff line number Diff line change @@ -323,11 +323,10 @@ export class GlobalState extends PureComponent<Props> {
323
323
324
324
refresh = async (
325
325
library ?: Runner | 'all' ,
326
- checkUpdates ?: boolean
326
+ checkUpdates = false
327
327
) : Promise < void > => {
328
328
console . log ( 'refreshing' )
329
329
330
- let updates = this . state . gameUpdates
331
330
const currentLibraryLength = this . state . epic . library ?. length
332
331
let epicLibrary : Array < GameInfo > =
333
332
( libraryStore . get ( 'library' , [ ] ) as Array < GameInfo > ) || [ ]
@@ -342,16 +341,13 @@ export class GlobalState extends PureComponent<Props> {
342
341
epicLibrary = legendaryLibrary
343
342
}
344
343
345
- try {
346
- const newUpdates : string [ ] = await ipcRenderer . invoke (
347
- 'checkGameUpdates' ,
348
- library
349
- )
350
- updates = checkUpdates
351
- ? [ ...new Set ( [ ...newUpdates , ...this . state . gameUpdates ] ) ]
352
- : this . state . gameUpdates
353
- } catch ( error ) {
354
- ipcRenderer . send ( 'logError' , error )
344
+ let updates = this . state . gameUpdates
345
+ if ( checkUpdates && library ) {
346
+ try {
347
+ updates = await ipcRenderer . invoke ( 'checkGameUpdates' )
348
+ } catch ( error ) {
349
+ ipcRenderer . send ( 'logError' , error )
350
+ }
355
351
}
356
352
357
353
this . setState ( {
You can’t perform that action at this time.
0 commit comments