️ Stop invalidating queries on page load

This commit is contained in:
Luke Vella 2023-03-20 19:14:20 +00:00
parent 88b455717a
commit 68bb17a00a
2 changed files with 6 additions and 2 deletions

View file

@ -7,7 +7,9 @@ import { trpc } from "../../utils/trpc";
* find polls that haven't been accessed for some time so that they can be deleted by house keeping. * find polls that haven't been accessed for some time so that they can be deleted by house keeping.
*/ */
export const useTouchBeacon = (pollId: string) => { export const useTouchBeacon = (pollId: string) => {
const touchMutation = trpc.polls.touch.useMutation(); const touchMutation = trpc.polls.touch.useMutation({
meta: { doNotInvalidate: true },
});
useMount(() => { useMount(() => {
touchMutation.mutate({ pollId }); touchMutation.mutate({ pollId });

View file

@ -16,7 +16,9 @@ export const trpc = createTRPCNext<AppRouter>({
* having a flash of content change whilst redirecting. * having a flash of content change whilst redirecting.
**/ **/
await opts.originalFn(); await opts.originalFn();
await opts.queryClient.invalidateQueries(); if (!opts.meta?.doNotInvalidate) {
await opts.queryClient.invalidateQueries();
}
}, },
}, },
}, },