mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-08 05:31:51 +02:00
⚡️ Stop invalidating queries on page load
This commit is contained in:
parent
88b455717a
commit
68bb17a00a
2 changed files with 6 additions and 2 deletions
|
@ -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 });
|
||||||
|
|
|
@ -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();
|
||||||
|
if (!opts.meta?.doNotInvalidate) {
|
||||||
await opts.queryClient.invalidateQueries();
|
await opts.queryClient.invalidateQueries();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue