From e8b77fb0a558186fd34221a66002b9976243c726 Mon Sep 17 00:00:00 2001 From: loki5512344 Date: Tue, 29 Sep 2026 10:14:18 +0200 Subject: [PATCH] fix(frontend): avatar history strip fills in without a reload addAvatarHistory was fired off without awaiting, then the history tick was bumped immediately, so the strip re-read IndexedDB before the write landed and only populated after a remount. Await the write before bumping the tick. --- .../src/features/account/components/avatar/AvatarUpload.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/features/account/components/avatar/AvatarUpload.tsx b/frontend/src/features/account/components/avatar/AvatarUpload.tsx index 4683a2f..df47d2d 100644 --- a/frontend/src/features/account/components/avatar/AvatarUpload.tsx +++ b/frontend/src/features/account/components/avatar/AvatarUpload.tsx @@ -25,9 +25,11 @@ export function AvatarUpload({ onReady }: { onReady?: (acceptFile: (file: File) const [historyTick, setHistoryTick] = useState(0) const mutation = useMutation({ mutationFn: (file: File) => uploadAvatarWithProgress(file, setProgress), - onSuccess: (_data, file) => { + onSuccess: async (_data, file) => { client.invalidateQueries({ queryKey: ['me'] }) - void addAvatarHistory(file) + // Await the write before bumping the tick, otherwise the history strip + // re-reads IndexedDB too early and only fills in after a remount (F5). + await addAvatarHistory(file).catch(() => undefined) setHistoryTick((n) => n + 1) setPicked(undefined) setProgress(null)