1.6 KiB
1.6 KiB
ZFS Pool Delete UI Update Fix
Issue
When a ZFS pool is destroyed, the pool is removed from the system and database, but the UI doesn't update immediately to reflect the deletion.
Root Cause
The frontend deletePoolMutation was not properly awaiting the refetch operation, which could cause race conditions where the UI doesn't update before the alert is shown.
Solution
Added await to refetchQueries to ensure the query is refetched before showing the success alert.
Changes Made
Updated frontend/src/pages/Storage.tsx
- Added
awaittorefetchQueriescall indeletePoolMutation.onSuccess - This ensures the pool list is refetched from the server before showing the success message
Key Changes:
onSuccess: async () => {
// Invalidate and immediately refetch
await queryClient.invalidateQueries({ queryKey: ['storage', 'zfs', 'pools'] })
await queryClient.refetchQueries({ queryKey: ['storage', 'zfs', 'pools'] }) // Added await
await queryClient.invalidateQueries({ queryKey: ['storage', 'disks'] })
setSelectedPool(null)
alert('Pool destroyed successfully!')
},
Additional Notes
- The frontend already has
refetchInterval: 3000(3 seconds) for automatic pool list refresh - Backend properly deletes pool from database in
DeletePoolfunction - ZFS Pool Monitor syncs pools every 2 minutes to catch manually deleted pools
Testing
- Destroy pool through UI
- Verify pool disappears from UI immediately
- Verify success alert is shown after UI update
Status
✅ FIXED - Pool deletion now properly updates UI
Date
2026-01-09