fix: update fetch calls for main games and library data loading#50
fix: update fetch calls for main games and library data loading#50zortos293 merged 1 commit intoOpenCloudGaming:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR swaps the priority of data fetching methods for the home view and adds a complete implementation for the library view data loading. The changes prioritize fetching from the main games panel first, falling back to the library when needed.
Key Changes:
- Swapped fetch order in
loadHomeData()to tryfetch_main_gamesfirst, then fall back tofetch_library - Implemented the previously empty
loadLibraryData()function with proper loading placeholders and API calls - Updated all console log messages and comments to reflect the new fetch order
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| renderGamesGrid("my-games", []); | ||
| } | ||
| } catch (error) { | ||
| console.error("Failed to load library data:", error); |
There was a problem hiding this comment.
When the library fetch fails, the placeholders are not cleared. This leaves the user seeing placeholder content instead of an indication that the library failed to load or is empty. Consider clearing the placeholders or showing an error message to provide better user feedback.
| console.error("Failed to load library data:", error); | |
| console.error("Failed to load library data:", error); | |
| // Clear loading placeholders on error | |
| renderGamesGrid("recently-played", []); | |
| renderGamesGrid("my-games", []); | |
| // Show a simple error message so the user knows the library failed to load | |
| const recentlyPlayedEl = document.getElementById("recently-played"); | |
| if (recentlyPlayedEl) { | |
| recentlyPlayedEl.innerHTML = | |
| '<div class="empty-state error-state">Failed to load recently played games.</div>'; | |
| } | |
| const myGamesEl = document.getElementById("my-games"); | |
| if (myGamesEl) { | |
| myGamesEl.innerHTML = | |
| '<div class="empty-state error-state">Failed to load your library.</div>'; | |
| } |
| try { | ||
| const accessToken = await invoke<string>("get_gfn_jwt"); |
There was a problem hiding this comment.
The function doesn't check if the user is authenticated before attempting to fetch library data. If a user navigates to the library view while not authenticated, the call to get_gfn_jwt will fail. Consider adding an authentication check similar to loadHomeData, which checks isAuthenticated and displays appropriate UI (like a login prompt) when the user is not authenticated.
fix: update fetch calls for main games and library data loading
fix: update fetch calls for main games and library data loading
Description
Related Issue
Fixes #
Type of Change
Platform Tested
Checklist
Screenshots (if applicable)
Additional Notes