Peform
Peform
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Peform on 4/28/2025 in #questions
mutation taking a long time to appear after prefetching query
server:
export default async function Page({ params }: Props) {
const { guildId, uuid } = await params;
const session = await auth();
if (!session) redirect(`/login?callbackUrl=/verify/${guildId}/${uuid}`);

await api.verification.isCaptchaValid.prefetch({ guildId, uuid });

return (
<HydrateClient>
<div className="flex flex-1 items-center justify-center lg:container">
<Content guildId={guildId} uuid={uuid} session={session} />
</div>
</HydrateClient>
);
}
export default async function Page({ params }: Props) {
const { guildId, uuid } = await params;
const session = await auth();
if (!session) redirect(`/login?callbackUrl=/verify/${guildId}/${uuid}`);

await api.verification.isCaptchaValid.prefetch({ guildId, uuid });

return (
<HydrateClient>
<div className="flex flex-1 items-center justify-center lg:container">
<Content guildId={guildId} uuid={uuid} session={session} />
</div>
</HydrateClient>
);
}
If I do use the error.tsx method is typescript able to obtain the trpc error type? I have a bunch of different errors that can happen on various endpoints and I set custom error messages which are used to tell the user what went wrong, but some error pages require more data than others, which is why I want to handle this on the frontend using the above method as I can know exactly which query errored and customize how the error is viewed as needed
11 replies
TTCTheo's Typesafe Cult
Created by Peform on 4/28/2025 in #questions
mutation taking a long time to appear after prefetching query
Hi, thank you for the response. I am using loading.tsx files for global loading page, which is working well, so I have not used <Suspense/>. Before you sent this updated message I was trying to do the below code, but unfortunately it just causes the frontend to crash because the query threw an error. A query that was dehydrated as pending ended up rejecting It looks like you can access the query states in the data variable, which includes the "error" but the page crashes before i can use this. I'm not sure im a big fan of using error.tsx pages, but i can give that a go if its not possible to do something like the below:
export const Content = ({ guildId, uuid, session }: Props) => {
const [isCaptchaValid, data] = api.verification.isCaptchaValid.useSuspenseQuery({
guildId,
uuid,
});

if (data.error) {
return <InvalidCaptcha session={session} error={data.error?.message ?? 'Invlaid captcha'} showLoggedInAs />;
}

return <h1>success</h1>;
};
export const Content = ({ guildId, uuid, session }: Props) => {
const [isCaptchaValid, data] = api.verification.isCaptchaValid.useSuspenseQuery({
guildId,
uuid,
});

if (data.error) {
return <InvalidCaptcha session={session} error={data.error?.message ?? 'Invlaid captcha'} showLoggedInAs />;
}

return <h1>success</h1>;
};
11 replies
TTCTheo's Typesafe Cult
Created by Peform on 4/28/2025 in #questions
mutation taking a long time to appear after prefetching query
still having alot of problems with this, everything I try just results in the same issue, or some incredibly bad code. I tried fetching inside of ssr component (without using prefetch) but parsing errors (trhow trpcError()) inside of a ssr component seems to be incredibly tedius, having to wrap try/catch and parse each error it could be.
11 replies
TTCTheo's Typesafe Cult
Created by Peform on 4/28/2025 in #questions
mutation taking a long time to appear after prefetching query
im just so confused, because the query knows it errored, but <hydrateclient> isn't passing the error object down to the client
11 replies
TTCTheo's Typesafe Cult
Created by Peform on 4/28/2025 in #questions
mutation taking a long time to appear after prefetching query
11 replies
TtRPC
Created by Peform on 4/28/2025 in #❓-help
mutation taking a long time to appear after prefetching query
im just so confused, because the query knows it errored, but <hydrateclient> isn't passing the error object down to the client A demonstration of the issue: https://gyazo.com/610a1e2d835445e70fd2400812cad7c9
2 replies
PPrisma
Created by Peform on 2/27/2025 in #help-and-questions
strictUndefinedChecks undesired behavior
Amazing, thanks 🙂
11 replies
PPrisma
Created by Peform on 2/27/2025 in #help-and-questions
strictUndefinedChecks undesired behavior
if not, is there anywhere i should be providing feedback for this feature before it exits preview
11 replies
PPrisma
Created by Peform on 2/27/2025 in #help-and-questions
strictUndefinedChecks undesired behavior
@Nurul do you have any input on this? ^
11 replies
PPrisma
Created by Peform on 2/27/2025 in #help-and-questions
strictUndefinedChecks undesired behavior
No description
11 replies
PPrisma
Created by angelplusultra on 6/11/2024 in #help-and-questions
PrismaClientInitializationError
i had this, to fix it i stopped using node 18 alpine, instead I now use: FROM node:18 AS builder @Jonathan
4 replies
TtRPC
Created by Peform on 3/1/2025 in #❓-help
server side prefetch + optional client side refetch
While this works, it feels like there should be a nicer way?. Is there a recommended approach for handling this server-prefetch + client-refresh scenario with tRPC in Next.js?
2 replies
PPrisma
Created by Peform on 2/27/2025 in #help-and-questions
strictUndefinedChecks undesired behavior
I think the current implementation of this will just introduce more bugs because we get no intellisense from typescript saying that this could potentially cause an error due to prisma not allowing undefined values
11 replies
PPrisma
Created by Peform on 2/27/2025 in #help-and-questions
strictUndefinedChecks undesired behavior
this doesn't really address the full problem of the findFirst. Before this new preview feature came into effect we'd have to remember to check if the field we were querying by was undefined or not, we seemlying still need to remember to do this for every potentially undefined field? Just going back to the original post,
If undefined values are indeed disallowed, wouldn’t it be helpful if the types only accepted a string or null instead? This way, any potential issues could be caught during development instead of at runtime.
I think this would be a major improvement, and it wouldn't require us to remember to use Prisma.skip everytime we use an undefined field?
11 replies
PPrisma
Created by Peform on 2/27/2025 in #help-and-questions
strictUndefinedChecks undesired behavior
I think this is a little annoying having to do this every time though no? This does fix the issue, but having to remember to do this everytime we update or create a value that is potentially undefined is a bit cumbersome?
11 replies
PPrisma
Created by Peform on 2/24/2025 in #help-and-questions
vercel Prisma Client could not locate the Query Engine
im very happy to see the strictUndefinedChecks preview feature in v6 🙂
6 replies
PPrisma
Created by Peform on 2/24/2025 in #help-and-questions
vercel Prisma Client could not locate the Query Engine
hi, i ended up downgrading to 5.4 again and it started working. However, I have just installed the latest version again and it all seems to be working fine? a bit confused, but ill take it as a win. I have not added any binary targets or packages as suggested above.
6 replies
TTCTheo's Typesafe Cult
Created by Peform on 2/21/2025 in #questions
create t3 app build error
Okay thank you for the responses 🙂
12 replies
TTCTheo's Typesafe Cult
Created by Peform on 2/21/2025 in #questions
create t3 app build error
Hi, Yes I am running turbo repo. I have just tried building after deleting the .next build folder, but still get the same error. (It seems to switch between showing /404 and /500 as the pages that are erroring? However, if I do remove NODE_ENV="DEVELOPMENT" the build errors stop, although I do use my node_env=dev in other apps in my monorepo, so i was hoping to keep this.
12 replies
TTCTheo's Typesafe Cult
Created by Peform on 2/21/2025 in #questions
create t3 app build error
No description
12 replies