feat: use await for firstSyncWithRemoteIfNeeded

This commit is contained in:
Zamitto
2025-07-30 07:52:52 -03:00
parent 737dc37433
commit d28a5b828f
3 changed files with 8 additions and 4 deletions

View File

@@ -80,7 +80,7 @@ const getUnlockedAchievementsEvent = async (
objectId: string,
shop: GameShop
): Promise<UserAchievement[]> => {
AchievementWatcherManager.firstSyncWithRemoteIfNeeded(shop, objectId);
await AchievementWatcherManager.firstSyncWithRemoteIfNeeded(shop, objectId);
return getUnlockedAchievements(objectId, shop, false);
};

View File

@@ -167,6 +167,8 @@ export class AchievementWatcherManager {
const gameKey = levelKeys.game(shop, objectId);
if (this.alreadySyncedGames.get(gameKey)) return;
this.alreadySyncedGames.set(gameKey, true);
const game = await gamesSublevel.get(gameKey).catch(() => null);
if (!game || game.isDeleted) return;
@@ -190,8 +192,6 @@ export class AchievementWatcherManager {
}
}
this.alreadySyncedGames.set(gameKey, true);
const newAchievements = await mergeAchievements(
game,
unlockedAchievements,

View File

@@ -36,7 +36,11 @@ export function GameItem({ game }: GameItemProps) {
(steamGenre) => steamGenre === genre
);
if (index && steamGenres[language] && steamGenres[language][index]) {
if (
index !== undefined &&
steamGenres[language] &&
steamGenres[language][index]
) {
return steamGenres[language][index];
}