Closed Shock9616 closed 8 months ago
I think part of the problem may be related to this code block in GameViewModel.swift
:
func loadGames() -> [Game] {
Task {
var steamGameNames: Set<String> = []
var crossoverGameNames: Set<String> = []
if Defaults[.steamDetection] {
steamGameNames = await detectSteamGames()
}
if Defaults[.crossOverDetection] {
crossoverGameNames = await detectCrossoverGames()
}
await compareSteamAndCrossoverGames(steamGameNames: steamGameNames, crossoverGameNames: crossoverGameNames)
}
let res = loadGamesFromJSON()
return res.games
}
The detect functions always return everything they find, so compareSteamAndCrossoverGames()
has to check every detected game every time Phoenix is launched.
Fixed in #139
Describe the bug After launching Phoenix from Xcode, I observed the
[INFO]: 'games.json' updated successfully.
message popping up multiple times in the console. Those messages corresponded with lag spikes which are especially noticeable while scrolling in the detail view. This only happens when I have automatic detection enabled, so I suspect that it's happening because the update function is being called every time Phoenix checks for a game, rather than only when a new game is detected.To Reproduce Steps to reproduce the behavior:
Expected behavior
games.json
should only be updated when I actually edit a game, or if a new one is detected, not every time an already detected game is checked.Screenshots (sorry the video was too big to upload directly) https://drive.google.com/file/d/1LJStPyNHHlnwGMjnOBhvbWvYut_YOeZo/view?usp=sharing
Logs log_2024-02-27 14:04:31.729000.log
Desktop (please complete the following information):
Additional context N/A