fix(settings): keep the language and save settings one after the other

This commit is contained in:
lobo committed 2026-09-29 13:27:31 +02:00
1 parent 14dd59f9e0
commit f605917874
25 files changed
+423 -98

No files matched your search

+15 -7
View File
@@ -89,6 +89,14 @@ export default function GameDetail() {
shownLevel.current = {appid: data.appid, level: celebrationLevel(data)};
}, [data]);
// Another game starts empty, already in this render. A reload of the same game keeps the old data, so the edit
// cards keep what is typed.
const [dataAppid, setDataAppid] = useState(appid);
if (dataAppid !== appid) {
setDataAppid(appid);
setData(null);
}
useEffect(() => {
let cancelled = false;
if (!hasSession()) {
@@ -111,11 +119,11 @@ export default function GameDetail() {
return;
}
if (response.status === 404) {
setError(t('GAME_DETAIL.NOT_FOUND'));
setError('GAME_DETAIL.NOT_FOUND');
return;
}
if (!response.ok) {
setError(t('GAME_DETAIL.ERROR_LOAD'));
setError('GAME_DETAIL.ERROR_LOAD');
return;
}
const json = await response.json();
@@ -123,7 +131,7 @@ export default function GameDetail() {
} catch (err) {
if (!cancelled) {
console.error('GameDetail load error:', err);
setError(t('INFO.ERROR.NETWORK_FAILURE'));
setError('INFO.ERROR.NETWORK_FAILURE');
}
} finally {
if (!cancelled) setIsLoading(false);
@@ -132,7 +140,7 @@ export default function GameDetail() {
return () => {
cancelled = true;
};
}, [appid, navigate, expireSession, t, reloads]);
}, [appid, navigate, expireSession, reloads]);
const sortedAchievements = useMemo(() => {
if (!data?.achievements) return [];
@@ -188,7 +196,7 @@ export default function GameDetail() {
<ArrowLeft/>{t('GAME_DETAIL.BACK')}
</Button>
{isLoading && (
{isLoading && !data && (
<div className="space-y-6">
<Skeleton className="h-52 rounded-xl"/>
<Skeleton className="h-40 rounded-xl"/>
@@ -197,12 +205,12 @@ export default function GameDetail() {
{error && !isLoading && (
<div className="py-12 text-center text-destructive space-y-4">
<p>{error}</p>
<p>{t(error)}</p>
<Button asChild variant="outline"><Link to="/library">{t('GAME_DETAIL.BACK_TO_LIBRARY')}</Link></Button>
</div>
)}
{!isLoading && !error && data && (
{!error && data && (
<>
{data.hidden && (
<div role="status" className="flex items-center gap-2 rounded-lg border bg-muted/50 px-4 py-3 text-sm text-muted-foreground">