fix(web): harden chat info profile loading for partial failures
Some checks are pending
CI / test (push) Has started running

This commit is contained in:
2026-03-08 21:45:23 +03:00
parent 97dd543d30
commit 3416d44afa
2 changed files with 9 additions and 5 deletions

View File

@@ -155,9 +155,11 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) {
}
}
if (missingIds.length) {
const profiles = await Promise.all(missingIds.map((id) => getUserById(id)));
const profiles = await Promise.allSettled(missingIds.map((id) => getUserById(id)));
for (const profile of profiles) {
byId[profile.id] = profile;
if (profile.status === "fulfilled") {
byId[profile.value.id] = profile.value;
}
}
}
setMemberUsers(byId);
@@ -169,10 +171,12 @@ export function ChatInfoPanel({ chatId, open, onClose }: Props) {
const nextBans = await listChatBans(targetChatId);
setBans(nextBans);
const ids = [...new Set(nextBans.flatMap((item) => [item.user_id, item.banned_by_user_id]))];
const profiles = await Promise.all(ids.map((id) => getUserById(id)));
const profiles = await Promise.allSettled(ids.map((id) => getUserById(id)));
const byId: Record<number, AuthUser> = {};
for (const profile of profiles) {
byId[profile.id] = profile;
if (profile.status === "fulfilled") {
byId[profile.value.id] = profile.value;
}
}
setBannedUsers(byId);
} catch {