Updated links model and poll page (#206)

* Improved sharing
* Updated desktop poll
This commit is contained in:
Luke Vella 2022-06-27 15:22:23 +01:00 committed by GitHub
parent c4cbf2f6bb
commit 2ead375b42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 955 additions and 1848 deletions

View file

@ -26,7 +26,7 @@ export const useAddParticipantMutation = () => {
queryClient.setQueryData(
["polls.participants.list", { pollId: participant.pollId }],
(existingParticipants = []) => {
return [participant, ...existingParticipants];
return [...existingParticipants, participant];
},
);
session.refresh();
@ -79,12 +79,12 @@ export const useDeleteParticipantMutation = () => {
};
export const useUpdatePollMutation = () => {
const { poll } = usePoll();
const { urlId, admin } = usePoll();
const plausible = usePlausible();
const queryClient = trpc.useContext();
return trpc.useMutation(["polls.update"], {
onSuccess: (data) => {
queryClient.setQueryData(["polls.get", { urlId: poll.urlId }], data);
queryClient.setQueryData(["polls.get", { urlId, admin }], data);
plausible("Updated poll");
},
});