Skip to content

Commit

Permalink
Refetch data on registration v2 update (thewca#9907)
Browse files Browse the repository at this point in the history
* refetch data if moving someone to and from the waiting list

* always refetch on update
  • Loading branch information
FinnIckler authored Sep 6, 2024
1 parent 97a7f8a commit b3b4620
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
});

Expand Down

0 comments on commit b3b4620

Please sign in to comment.