Skip to content

Commit

Permalink
[FIX] Show correct number of gamecards in recently played. (#2862)
Browse files Browse the repository at this point in the history
[FIX] Show correct number of gamecards.
  • Loading branch information
Etaash-mathamsetty committed Jul 16, 2023
1 parent ef07f6f commit 297bf24
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/frontend/screens/Library/components/RecentlyPlayed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ interface Props {
onlyInstalled: boolean
}

function getRecentGames(libraries: GameInfo[], limit: number): GameInfo[] {
function getRecentGames(
libraries: GameInfo[],
limit: number,
onlyInstalled: boolean
): GameInfo[] {
const recentGames = configStore.get('games.recent', [])

const games: GameInfo[] = []

for (const recent of recentGames) {
const found = libraries.find((game) => game.app_name === recent.appName)
if (found) {
if (onlyInstalled && !found.is_installed) continue
games.push(found)
if (games.length === limit) break
}
Expand All @@ -43,7 +48,8 @@ export default React.memo(function RecentlyPlayed({
...sideloadedLibrary,
...amazon.library
],
maxRecentGames
maxRecentGames,
onlyInstalled
)

setRecentGames(newRecentGames)
Expand Down

0 comments on commit 297bf24

Please sign in to comment.