Web Dev Cody
Web Dev Cody
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Web Dev Cody on 7/3/2023 in #questions
App router question about Link
So, I have two pages. Page A has a <Link href="/b" />, Page B has a Math.random() called during the RSC run through. Page B also has a link back to page A. If I keep navigating between these pages, the Math.random is only ever called once. This is due to the soft navigation in next. How do I prevent or turn this off for a page? export const revalidate = 0 does nothing. I know I could manually do a router.replace then router.refresh, but that's very hacky obviously
10 replies
TTCTheo's Typesafe Cult
Created by Web Dev Cody on 5/2/2023 in #questions
tRPC suppressing server logs?
I noticed that when my tRPc mutation throws an error, the error is sent to the front end but nothing is logged from my server. Is there somewhere I need to update to print all exceptions?
8 replies
TTCTheo's Typesafe Cult
Created by Web Dev Cody on 2/27/2023 in #questions
has anyone successfully setup t3 with jest + rtl?
I'm getting a Error: Uncaught [TypeError: Cannot read properties of undefined (reading 'trpcState')] error when I try to setup my next page component.
1 replies
TTCTheo's Typesafe Cult
Created by Web Dev Cody on 2/23/2023 in #questions
tRPC response time sometimes takes very long
119 replies
TTCTheo's Typesafe Cult
Created by Web Dev Cody on 2/1/2023 in #questions
Type Errors when importing AppRouter from npm workspace TRPC server
3 replies
TTCTheo's Typesafe Cult
Created by Web Dev Cody on 1/28/2023 in #questions
Getting ts-jest to work with testing files that use the .env mjs files
I'm trying to write a unit test to verify some code. This code uses the t3 env variable which is setup in these .mjs files. When I run jest it keeps failing to import from "./schema.mjs". Does anyone have an example repo which has test working fine in this scenario?
10 replies
TTCTheo's Typesafe Cult
Created by Web Dev Cody on 1/25/2023 in #questions
Proper way to handle TRPC server errors on client?
I have some code that looks a little like this, but I'm not too sure what we should be putting in the catch for typing the error. I'm just using the default t3 stack error formatter. Is there a built in type for the client I can use that doesn't require me to JSON.parse the error object?
subscribe
.mutateAsync({
email: form.email,
})
.then(() => {
return router.push("/success");
})
.catch((err: Error) => {
const message = err.message;
const errors = JSON.parse(message) as {
message: string;
}[];
setError(
errors.length === 0
? "something went wrong =("
: errors[0]?.message ?? "something went wrong"
);
})
subscribe
.mutateAsync({
email: form.email,
})
.then(() => {
return router.push("/success");
})
.catch((err: Error) => {
const message = err.message;
const errors = JSON.parse(message) as {
message: string;
}[];
setError(
errors.length === 0
? "something went wrong =("
: errors[0]?.message ?? "something went wrong"
);
})
3 replies
TTCTheo's Typesafe Cult
Created by Web Dev Cody on 10/4/2022 in #questions
railway app websockets?
Any clue if railway supports a server using websockets?
14 replies
TTCTheo's Typesafe Cult
Created by Web Dev Cody on 9/28/2022 in #questions
Accessibility question about Cards
4 replies