From b3b4620a2123ff27d5b97973676d835679dc0abc Mon Sep 17 00:00:00 2001 From: FinnIckler Date: Fri, 6 Sep 2024 14:22:55 +0200 Subject: [PATCH] Refetch data on registration v2 update (#9907) * refetch data if moving someone to and from the waiting list * always refetch on update --- .../RegistrationAdministrationList.jsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/webpacker/components/RegistrationsV2/RegistrationAdministration/RegistrationAdministrationList.jsx b/app/webpacker/components/RegistrationsV2/RegistrationAdministration/RegistrationAdministrationList.jsx index cb7b419371..20e7289edd 100644 --- a/app/webpacker/components/RegistrationsV2/RegistrationAdministration/RegistrationAdministrationList.jsx +++ b/app/webpacker/components/RegistrationsV2/RegistrationAdministration/RegistrationAdministrationList.jsx @@ -173,14 +173,12 @@ export default function RegistrationAdministrationList({ competitionInfo }) { 'negative', )); }, - onSuccess: (data) => { - const { updated_registrations: updatedRegistrations } = data; - const updated = registrations.map( - (r) => (updatedRegistrations[r.user_id] - ? { ...updatedRegistrations[r.user_id], payment: r.payment } - : r), - ); - queryClient.setQueryData(['registrations-admin', competitionInfo.id], updated); + onSuccess: async () => { + // If multiple organizers approve people at the same time, + // or if registrations are still coming in while organizers approve them + // we want the data to be refreshed. Optimal solution would be subscribing to changes + // via graphql/websockets, but we aren't there yet + await refetch(); }, });