From 2fe0db6d9a37a301807fff567da2b66924719832 Mon Sep 17 00:00:00 2001 From: Matthias Hochmeister Date: Thu, 16 Apr 2026 09:17:36 +0200 Subject: [PATCH] fix(persoenliche-ausruestung): wait for permissions before fetching overview to show all items --- frontend/src/pages/PersoenlicheAusruestung.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/PersoenlicheAusruestung.tsx b/frontend/src/pages/PersoenlicheAusruestung.tsx index c6e3381..3560309 100644 --- a/frontend/src/pages/PersoenlicheAusruestung.tsx +++ b/frontend/src/pages/PersoenlicheAusruestung.tsx @@ -27,7 +27,7 @@ import type { ZustandOption } from '../types/personalEquipment.types'; function PersoenlicheAusruestungPage() { const navigate = useNavigate(); - const { hasPermission } = usePermissionContext(); + const { hasPermission, isLoading: permissionsLoading } = usePermissionContext(); const canViewAll = hasPermission('persoenliche_ausruestung:view_all'); const canCreate = hasPermission('persoenliche_ausruestung:create'); @@ -41,9 +41,10 @@ function PersoenlicheAusruestungPage() { // Data queries const { data: items, isLoading } = useQuery({ - queryKey: ['persoenliche-ausruestung', 'all'], + queryKey: ['persoenliche-ausruestung', canSeeAll ? 'all' : 'my'], queryFn: () => canSeeAll ? personalEquipmentApi.getAll() : personalEquipmentApi.getMy(), staleTime: 2 * 60 * 1000, + enabled: !permissionsLoading, }); const { data: zustandOptions = [] } = useQuery({