Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
⚡️ Quicker UI updates when adding participant (#1045)
Luke Vellafe856d6c7dde
diff --git a/apps/web/src/components/poll/mutations.ts b/apps/web/src/components/poll/mutations.tsindex e4372a014..a973d7917 100644--- a/apps/web/src/components/poll/mutations.ts+++ b/apps/web/src/components/poll/mutations.ts@@ -19,7 +19,17 @@ export const useAddParticipantMutation = () => {const queryClient = trpc.useUtils();return trpc.polls.participants.add.useMutation({- onSuccess: (_, { pollId, name, email }) => {+ onSuccess: (newParticipant, input) => {+ const { pollId, name, email } = newParticipant;+ queryClient.polls.participants.list.setData(+ { pollId },+ (existingParticipants = []) => {+ return [+ { ...newParticipant, votes: input.votes },+ ...existingParticipants,+ ];+ },+ );queryClient.polls.participants.list.invalidate({ pollId });posthog?.capture("add participant", {pollId,