Files
calypso/ZFS-POOL-DELETE-UI-FIX.md
2026-01-09 16:54:39 +00:00

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 await to refetchQueries call in deletePoolMutation.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 DeletePool function
  • ZFS Pool Monitor syncs pools every 2 minutes to catch manually deleted pools

Testing

  1. Destroy pool through UI
  2. Verify pool disappears from UI immediately
  3. Verify success alert is shown after UI update

Status

FIXED - Pool deletion now properly updates UI

Date

2026-01-09