⬆️ Upgrade to trpc 11 (#1703)

This commit is contained in:
Luke Vella 2025-04-30 15:14:47 +01:00 committed by GitHub
parent 5a4ee56df6
commit 4a98a6ac82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 131 additions and 78 deletions

View file

@ -40,11 +40,13 @@
"@sentry/nextjs": "^9.14.0",
"@svgr/webpack": "^8.1.0",
"@t3-oss/env-nextjs": "^0.11.0",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query": "^5.74.11",
"@tanstack/react-query-devtools": "^5.74.11",
"@tanstack/react-table": "^8.9.1",
"@trpc/client": "^10.13.0",
"@trpc/react-query": "^10.13.0",
"@trpc/server": "^10.13.0",
"@trpc/client": "^11.1.2",
"@trpc/next": "^11.1.2",
"@trpc/react-query": "^11.1.2",
"@trpc/server": "^11.1.2",
"@upstash/qstash": "^2.7.17",
"@upstash/ratelimit": "^1.2.1",
"@vercel/functions": "^2.0.0",

View file

@ -64,7 +64,7 @@ export const LoginPage = ({ magicLink, email }: PageProps) => {
<div>
<Button
size="lg"
loading={magicLinkFetch.isLoading}
loading={magicLinkFetch.isPending}
onClick={async () => {
await magicLinkFetch.mutateAsync();
}}

View file

@ -73,7 +73,7 @@ export function OTPForm({ token }: { token: string }) {
const isLoading =
form.formState.isSubmitting ||
form.formState.isSubmitSuccessful ||
authenticateRegistration.isLoading;
authenticateRegistration.isPending;
return (
<Form {...form}>

View file

@ -111,7 +111,7 @@ export function DeleteAccountDialog({
</DialogClose>
<Button
type="submit"
loading={deleteAccount.isLoading}
loading={deleteAccount.isPending}
variant="destructive"
>
<Trans i18nKey="deleteAccount" defaults="Delete Account" />

View file

@ -1,6 +1,6 @@
import { prisma } from "@rallly/database";
import { absoluteUrl } from "@rallly/utils/absolute-url";
import { Hydrate, dehydrate } from "@tanstack/react-query";
import { HydrationBoundary, dehydrate } from "@tanstack/react-query";
import { notFound } from "next/navigation";
import { InvitePage } from "@/app/[locale]/invite/[urlId]/invite-page";
@ -45,13 +45,13 @@ export default async function Page(props: {
}
return (
<Hydrate state={dehydrate(trpc.queryClient)}>
<HydrationBoundary state={dehydrate(trpc.queryClient)}>
<Providers>
<PermissionContext token={searchParams.token}>
<InvitePage />
</PermissionContext>
</Providers>
</Hydrate>
</HydrationBoundary>
);
}

View file

@ -65,7 +65,7 @@ export function DuplicateDialog({
</DialogClose>
<Button
type="submit"
loading={duplicate.isLoading}
loading={duplicate.isPending}
variant="primary"
form={formName}
>

View file

@ -22,7 +22,7 @@ import { Trans } from "@/components/trans";
const Page = () => {
const { poll } = usePoll();
const urlId = poll.adminUrlId;
const { mutate: updatePollMutation, isLoading: isUpdating } =
const { mutate: updatePollMutation, isPending: isUpdating } =
useUpdatePollMutation();
const router = useRouter();

View file

@ -35,7 +35,7 @@ const convertOptionToString = (
const Page = () => {
const { poll, getParticipantsWhoVotedForOption } = usePoll();
const { mutate: updatePollMutation, isLoading: isUpdating } =
const { mutate: updatePollMutation, isPending: isUpdating } =
useUpdatePollMutation();
const { t } = useTranslation();
const modalContext = useModalContext();

View file

@ -1,5 +1,5 @@
import { prisma } from "@rallly/database";
import { Hydrate, dehydrate } from "@tanstack/react-query";
import { HydrationBoundary, dehydrate } from "@tanstack/react-query";
import { notFound } from "next/navigation";
import { PollLayout } from "@/components/layouts/poll-layout";
@ -27,9 +27,9 @@ export default async function Layout(
}
return (
<Hydrate state={dehydrate(trpc.queryClient)}>
<HydrationBoundary state={dehydrate(trpc.queryClient)}>
<PollLayout>{children}</PollLayout>
</Hydrate>
</HydrationBoundary>
);
}

View file

@ -138,7 +138,7 @@ export const CreatePoll: React.FunctionComponent = () => {
<PollSettingsForm />
<hr />
<Button
loading={createPoll.isLoading || createPoll.isSuccess}
loading={createPoll.isPending || createPoll.isSuccess}
size="lg"
type="submit"
className="w-full"

View file

@ -157,7 +157,7 @@ const DeleteParticipantModal = ({
<Trans i18nKey="cancel" />
</Button>
<Button
loading={deleteParticipant.isLoading}
loading={deleteParticipant.isPending}
variant="destructive"
onClick={async () => {
deleteParticipant.mutate({

View file

@ -52,7 +52,7 @@ export const DeletePollDialog: React.FunctionComponent<{
onClick={() => {
deletePoll.mutate({ urlId });
}}
loading={deletePoll.isLoading}
loading={deletePoll.isPending}
>
<Trans i18nKey="delete" />
</Button>

View file

@ -250,7 +250,7 @@ export function FinalizePollDialog(props: DialogProps) {
</Button>
</DialogClose>
<Button
loading={scheduleEvent.isLoading}
loading={scheduleEvent.isPending}
type="submit"
form="finalize-form"
variant="primary"

View file

@ -25,7 +25,6 @@ export function TRPCProvider(props: { children: React.ReactNode }) {
defaultOptions: {
queries: {
retry: false,
cacheTime: Number.POSITIVE_INFINITY,
staleTime: 1000 * 60,
},
},
@ -73,9 +72,9 @@ export function TRPCProvider(props: { children: React.ReactNode }) {
links: [
httpBatchLink({
url: "/api/trpc",
transformer: superjson,
}),
],
transformer: superjson,
}),
);
return (