Skip to content

Commit 8754058

Browse files
committed
Always get game updates from all libraries
This fixes an issue where refreshing the library while only showing one library made the update icons of all the others disappear
1 parent d428185 commit 8754058

File tree

2 files changed

+13
-24
lines changed

2 files changed

+13
-24
lines changed

src/backend/main.ts

+5-12
Original file line numberDiff line numberDiff line change
@@ -638,18 +638,11 @@ ipcMain.handle(
638638

639639
/// IPC handlers begin here.
640640

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+
]
653646
})
654647

655648
ipcMain.handle('getEpicGamesStatus', async () => isEpicServiceOffline())

src/frontend/state/GlobalState.tsx

+8-12
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,10 @@ export class GlobalState extends PureComponent<Props> {
323323

324324
refresh = async (
325325
library?: Runner | 'all',
326-
checkUpdates?: boolean
326+
checkUpdates = false
327327
): Promise<void> => {
328328
console.log('refreshing')
329329

330-
let updates = this.state.gameUpdates
331330
const currentLibraryLength = this.state.epic.library?.length
332331
let epicLibrary: Array<GameInfo> =
333332
(libraryStore.get('library', []) as Array<GameInfo>) || []
@@ -342,16 +341,13 @@ export class GlobalState extends PureComponent<Props> {
342341
epicLibrary = legendaryLibrary
343342
}
344343

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+
}
355351
}
356352

357353
this.setState({

0 commit comments

Comments
 (0)