From 49b0f7b7da6698b95b43a6bfcd7f28875635f3b7 Mon Sep 17 00:00:00 2001 From: Jacob Pihl Date: Wed, 1 Nov 2023 14:56:06 +0100 Subject: [PATCH] Close reservations modal when deleting reservation Upon deleting a reserved material, the user can be stuck in an infinite loop, because the underlying reservations modal is not closed after deleting a reservation. This change always closes the reservationsQueued modal when deleting a reserved material. --- .../modal/delete-reservation/delete-reservation-modal.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/apps/reservation-list/modal/delete-reservation/delete-reservation-modal.tsx b/src/apps/reservation-list/modal/delete-reservation/delete-reservation-modal.tsx index f8c083c82d..a841fe6eb4 100644 --- a/src/apps/reservation-list/modal/delete-reservation/delete-reservation-modal.tsx +++ b/src/apps/reservation-list/modal/delete-reservation/delete-reservation-modal.tsx @@ -12,6 +12,7 @@ import { useDeleteV1UserReservationsIdentifier } from "../../../../core/publizon/publizon"; import { isFaust, isIdentifier } from "../../../dashboard/util/helpers"; +import { getModalIds } from "../../../../core/utils/helpers/general"; interface DeleteReservationModalProps { modalId: string; @@ -28,6 +29,7 @@ const DeleteReservationModal: FC = ({ const { mutate: deleteDigitalReservation } = useDeleteV1UserReservationsIdentifier(); const { close } = useModalButtonHandler(); + const { reservationsQueued } = getModalIds(); const removeSelectedReservations = () => { if (reservations.length > 0) { @@ -65,6 +67,7 @@ const DeleteReservationModal: FC = ({ ) ); + close(reservationsQueued as string); close(modalId as string); } };