(fix): connections
Some checks failed
/ build-web (push) Failing after 1m0s
/ build-desktop (linux) (push) Failing after 1m13s
/ build-mobile (push) Failing after 1m13s
/ release (push) Has been skipped

This commit is contained in:
Alois 2026-07-28 12:45:08 +02:00
commit 676dea2aa4
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24
7 changed files with 92 additions and 127 deletions

View file

@ -61,17 +61,18 @@ export default function UserProvider(props: { children: ReactNode }) {
const request = (async () => {
const cache = accountId ? createCache(String(accountId)) : null;
const cached =
const cachedValue =
storageRef.current[userId] ?? (await cache?.profiles.get(userId));
const cachedResult =
schemas.GetUserData.response.safeParse(cachedValue);
const cached = cachedResult.success ? cachedResult.data : undefined;
if (cached) storageRef.current[userId] = cached;
try {
const userData = await send("GetUserData", { UserId: userId });
const user = {
...userData.data,
avatar: userData.data.Avatar
? `data:image/webp;base64,${atob(userData.data.Avatar)}`
: undefined,
};
if (userData.type.startsWith("Error")) {
throw new Error(`GetUserData failed: ${userData.type}`);
}
const user = userData.data;
storageRef.current[userId] = user;
return user;
} catch (error) {