Fix pagespeed monitor deletion failing with undefined ID

The delete handler was using monitor._id from state, which was undefined
because the fetched monitor object didn't have _id populated. Changed to
use monitorId directly from URL params, which is already available and
used by other handlers in the same component (e.g., handlePause).

Fixes "Failed to delete monitor" error when removing pagespeed monitors.
This commit is contained in:
gorkem-bwl committed 2026-01-15 21:27:37 -05:00
1 parent 2f2ce34373
commit 8814596d6e
1 file changed
+1 -2
+1 -2
View File
@@ -178,8 +178,7 @@ const PageSpeedSetup = () => {
const handleRemove = async (event) => {
event.preventDefault();
const TEMP_MONITOR = { id: monitor._id };
await deleteMonitor({ monitor: TEMP_MONITOR, redirect: "/pagespeed" });
await deleteMonitor({ monitor: { id: monitorId }, redirect: "/pagespeed" });
};
const isBusy = isLoading || isCreating || isDeleting || isUpdating || isPausing;