Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

⚡️ Stop invalidating queries on page load

Luke Vella68bb17a00a83
diff --git a/apps/web/src/components/poll/use-touch-beacon.ts b/apps/web/src/components/poll/use-touch-beacon.ts
index 00f190488..af99cf4b0 100644
--- a/apps/web/src/components/poll/use-touch-beacon.ts
+++ b/apps/web/src/components/poll/use-touch-beacon.ts
@@ -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.
*/
export const useTouchBeacon = (pollId: string) => {
- const touchMutation = trpc.polls.touch.useMutation();
+ const touchMutation = trpc.polls.touch.useMutation({
+ meta: { doNotInvalidate: true },
+ });
useMount(() => {
touchMutation.mutate({ pollId });
diff --git a/apps/web/src/utils/trpc.ts b/apps/web/src/utils/trpc.ts
index ad5c2397d..041718354 100644
--- a/apps/web/src/utils/trpc.ts
+++ b/apps/web/src/utils/trpc.ts
@@ -16,7 +16,9 @@ export const trpc = createTRPCNext<AppRouter>({
* having a flash of content change whilst redirecting.
**/
await opts.originalFn();
- await opts.queryClient.invalidateQueries();
+ if (!opts.meta?.doNotInvalidate) {
+ await opts.queryClient.invalidateQueries();
+ }
},
},
},