"use client";
import { trpc } from "@/utils/trpc";
import { useQueryClient } from "@tanstack/react-query";
import { getQueryKey } from "@trpc/react-query";
export function TrpcMainLayoutDefaults() {
const queryClient = useQueryClient();
// Reaction Types
const reactionTypesKey = getQueryKey(trpc.reaction.getTypes);
queryClient.setQueryDefaults(reactionTypesKey, {
staleTime: Infinity,
});
// I had originally prefetched, but it seems this just adds an unneeded request (understandably)
// trpc.useUtils().reaction.getTypes.prefetch()
// Other...
return <></>;
}
"use client";
import { trpc } from "@/utils/trpc";
import { useQueryClient } from "@tanstack/react-query";
import { getQueryKey } from "@trpc/react-query";
export function TrpcMainLayoutDefaults() {
const queryClient = useQueryClient();
// Reaction Types
const reactionTypesKey = getQueryKey(trpc.reaction.getTypes);
queryClient.setQueryDefaults(reactionTypesKey, {
staleTime: Infinity,
});
// I had originally prefetched, but it seems this just adds an unneeded request (understandably)
// trpc.useUtils().reaction.getTypes.prefetch()
// Other...
return <></>;
}