From a87bb16e5ae823a79c6250ef398bcfcf422b3b41 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Sun, 15 Mar 2026 21:41:16 +0100 Subject: [PATCH] Fix badge slots showing empty on room enter Use avatarInfo badges as fallback when hook data not yet loaded Co-Authored-By: medievalshell --- .../avatar-info/infostand/InfoStandBadgeSlotView.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/room/widgets/avatar-info/infostand/InfoStandBadgeSlotView.tsx b/src/components/room/widgets/avatar-info/infostand/InfoStandBadgeSlotView.tsx index 05c54d4..951df53 100644 --- a/src/components/room/widgets/avatar-info/infostand/InfoStandBadgeSlotView.tsx +++ b/src/components/room/widgets/avatar-info/infostand/InfoStandBadgeSlotView.tsx @@ -81,9 +81,10 @@ export const InfoStandBadgeSlotView: FC = ({ slotIndex, const [ isDragOver, setIsDragOver ] = useState(false); const [ showPicker, setShowPicker ] = useState(false); - // For own user, use activeBadgeCodes from the hook (updates immediately on drag/drop) - // For other users, use the badge code from props (from server via avatarInfo) - const badgeCode = isOwnUser ? (activeBadgeCodes[slotIndex] ?? null) : badgeCodeFromProps; + // For own user: use hook data if loaded, otherwise fall back to props (avatarInfo) + // For other users: always use props + const hookBadge = activeBadgeCodes.length > 0 ? (activeBadgeCodes[slotIndex] ?? null) : null; + const badgeCode = isOwnUser ? (hookBadge ?? badgeCodeFromProps ?? null) : (badgeCodeFromProps ?? null); const onDragStart = useCallback((event: React.DragEvent) => {