diff --git a/src/ts/AchievementsManager.ts b/src/ts/AchievementsManager.ts index 1721372..10a1d8e 100644 --- a/src/ts/AchievementsManager.ts +++ b/src/ts/AchievementsManager.ts @@ -649,6 +649,17 @@ export class AchievementManager implements Manager return false; }) + // NOTE: Checks for games what does not exists in user library and removes them from + // `cache` configuration + const gameIdsToBeRemoved = Object.keys(this.customIdsOverrides) + .filter((appId) => !allNonSteamAppIds.includes(Number.parseInt(appId, 10))); + + for (const gameIdToBeRemoved of gameIdsToBeRemoved) { + const gameIdToBeRemovedAsNumber = Number.parseInt(gameIdToBeRemoved, 10); + + delete this.ids[gameIdToBeRemovedAsNumber] + delete this.customIdsOverrides[gameIdToBeRemovedAsNumber] + } await this.refreshAchievementsForApps(nonSteamAppIdsWithRetroAchievementId); } diff --git a/src/ts/components/settingsComponent.tsx b/src/ts/components/settingsComponent.tsx index b1bb53e..d288ccf 100644 --- a/src/ts/components/settingsComponent.tsx +++ b/src/ts/components/settingsComponent.tsx @@ -154,7 +154,7 @@ const CustomIdsOverrides: VFC = () => { const { custom_ids_overrides }= emuchievementsState.settings.data.cache; const gameOptions = Object.keys(custom_ids_overrides) .map((item) => { - const idAsNumber = Number.parseInt(item); + const idAsNumber = Number.parseInt(item, 10); const currentApp = custom_ids_overrides[idAsNumber]; return { @@ -190,7 +190,7 @@ const CustomIdsOverrides: VFC = () => { continue } - const appIdAsNumber = Number.parseInt(appId); + const appIdAsNumber = Number.parseInt(appId, 10); if (!retroAchievementAppId) { emuchievementsState.settings.data.cache.custom_ids_overrides[appIdAsNumber] = { @@ -202,7 +202,7 @@ const CustomIdsOverrides: VFC = () => { continue; } - const retroAchievementAppIdAsNumber = Number.parseInt(retroAchievementAppId); + const retroAchievementAppIdAsNumber = Number.parseInt(retroAchievementAppId, 10); if (Number.isNaN(retroAchievementAppIdAsNumber) || retroAchievementAppIdAsNumber <= 0) { emuchievementsState.settings.data.cache.custom_ids_overrides[appIdAsNumber] = {