Public Access
perf(library): one dashboard call, stored game detail first
The Dashboard loads the top and playing tiles from GET /api/library/dashboard-games in one call. The game page shows the stored game first (refresh=false) and calls again only when achievementsStale is true. The second answer merges the achievement fields; it takes status and finishedHint only when the user did not change the status. The points check runs again after the refresh. Refs #47
This commit is contained in:
1 parent
73ad4fd3b8
commit
0924600d95
10 files changed
+179
-36
No files matched your search
@@ -12,9 +12,10 @@ const waitingKey = (kind, reason) => (kind === 'FINISHED_TOPUP' ? WAITING_TOPUP.
|
||||
|
||||
/**
|
||||
* What the game earned: one line per paid row and one per kind that is missing, with the reason from Core. Loading it
|
||||
* settles the points; a status change after the first load also shows the points toast.
|
||||
* settles the points; a status change after the first load also shows the points toast. `refreshes` loads it again
|
||||
* after the Steam refresh of the game page, which may have stored an unlock that settles points.
|
||||
*/
|
||||
export default function GamePointsLine({game}) {
|
||||
export default function GamePointsLine({game, refreshes = 0}) {
|
||||
const {t, i18n} = useTranslation();
|
||||
const check = usePointsCheck();
|
||||
const [points, setPoints] = useState(null);
|
||||
@@ -30,7 +31,7 @@ export default function GamePointsLine({game}) {
|
||||
return () => {
|
||||
stale = true;
|
||||
};
|
||||
}, [check, game.appid, game.status]);
|
||||
}, [check, game.appid, game.status, refreshes]);
|
||||
|
||||
if (!points) return null;
|
||||
const earlySinceText = points.earlySince && formatDay(points.earlySince, i18n.language, {dateStyle: 'medium'});
|
||||
|
||||
Reference in new issue
Block a user