From f404a28b1d32831831b78f71b7b882ee280d9192 Mon Sep 17 00:00:00 2001 From: Mikkel Jakobsen Date: Sat, 2 Dec 2023 22:10:27 +0100 Subject: [PATCH] Make sure to invalidate BOTH digital and physical reservations when deleting them. --- .../modal/delete-reservation/delete-reservation-modal.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 41d8649474..91646e9020 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 @@ -3,7 +3,10 @@ import { UseMutateFunction, useQueryClient } from "react-query"; import Modal from "../../../../core/utils/modal"; import { useText } from "../../../../core/utils/text"; import DeleteReservationContent from "./delete-reservation-content"; -import { useDeleteReservations } from "../../../../core/fbs/fbs"; +import { + getGetReservationsV2QueryKey, + useDeleteReservations +} from "../../../../core/fbs/fbs"; import { getGetV1UserReservationsQueryKey, useDeleteV1UserReservationsIdentifier @@ -88,7 +91,9 @@ const DeleteReservationModal: FC = ({ // Since we got success, we can assume that all reservations // were successfully deleted. setDeletedReservations(reservations.length); + // Invalidate queries to update the UI. queryClient.invalidateQueries(getGetV1UserReservationsQueryKey()); + queryClient.invalidateQueries(getGetReservationsV2QueryKey()); } });