Mr.T 🐻⛓
Mr.T 🐻⛓
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Mr.T 🐻⛓ on 11/13/2023 in #questions
Internationalisation within T3 App router
I can't seem to make it work currently, I wonder if you guys have used any tutorial out there to have internationalisation along with the T3 stack yet?
2 replies
TTCTheo's Typesafe Cult
Created by Mr.T 🐻⛓ on 10/25/2023 in #questions
Error on TRPC while fetching data inside Auth.ts
I'm using CredentialsProvider from next auth, and I need to fetch some data to check some data related to the user before I can authorize that user to log in. I have a simple query inside the "authorize" callback, but this throws a TRPC:
input: undefined,
result: TRPCClientError: fetch failed
at TRPCClientError.from (webpack-internal:///(rsc)/./node_modules/@trpc/client/dist/TRPCClientError-0de4d231.mjs:41:16)
at eval (webpack-internal:///(rsc)/./node_modules/@trpc/client/dist/httpUtils-f58ceda1.mjs:132:81) {
meta: {},
shape: undefined,
data: undefined,
[cause]: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11) {
cause: [RequestContentLengthMismatchError]
}
},
input: undefined,
result: TRPCClientError: fetch failed
at TRPCClientError.from (webpack-internal:///(rsc)/./node_modules/@trpc/client/dist/TRPCClientError-0de4d231.mjs:41:16)
at eval (webpack-internal:///(rsc)/./node_modules/@trpc/client/dist/httpUtils-f58ceda1.mjs:132:81) {
meta: {},
shape: undefined,
data: undefined,
[cause]: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11) {
cause: [RequestContentLengthMismatchError]
}
},
Note that the query works fine when I run it in a server component, so I'm a bit unsure what could be the issue here.. Anyone has an idea? Thanks in advance
4 replies
TTCTheo's Typesafe Cult
Created by Mr.T 🐻⛓ on 10/10/2023 in #questions
Why do I have to check if function is null inside an if?
Hello everyone, sorry for the very generic question, but I can't seem to find an answer and I'm a bit confused, let's see with an example:

{props.showForm && (
<DropdownMenuItem onClick={() => props.showForm()}>
<span>Log result</span>
</DropdownMenuItem>
)}

{props.showForm && (
<DropdownMenuItem onClick={() => props.showForm()}>
<span>Log result</span>
</DropdownMenuItem>
)}
Does anyone know why this has an error Cannot invoke an object which is possibly 'undefined' even though I've made the check inside the if? Thanks in advance!
6 replies
DTDrizzle Team
Created by Mr.T 🐻⛓ on 10/2/2023 in #help
Can't reference an array of enum in a table
I'm trying to define a column in a table such as: abilitiesRequired: abilities("abilitiesRequired").array(), but I get an error saying that abilities[] does not exist. How should i define that column so we can have one or multiple enums in ? Thank you
1 replies
DTDrizzle Team
Created by Mr.T 🐻⛓ on 9/25/2023 in #help
Can't filter using 'query' when relation is one to one
Hello, I'm trying to use where filter on this query:
const qb = db.query.event.findMany({
with: {
workoutSession: {
where: eq(workoutSession.athleteId, userId),
with: {
workoutResult: {
with: {
workout: true,
},
},
},
},
},
})
const qb = db.query.event.findMany({
with: {
workoutSession: {
where: eq(workoutSession.athleteId, userId),
with: {
workoutResult: {
with: {
workout: true,
},
},
},
},
},
})
And for some reason, where just isn't an option when event <-> workoutSession are a one-to-one relationship if I create a one-to-many relationship in the schema, then I can safely use where here. I wonder if that is something normal 🤔 Thanks!
4 replies
DTDrizzle Team
Created by Mr.T 🐻⛓ on 9/16/2023 in #help
Trying to get relations from one table to another, as one-to-many but get only one value
I have a one-to-many relation on a table, and I want to get all the workoutResults associated with a workoutSession. My query looks like this:
const qb = db
.select()
.from(workoutSession)
// .leftJoin(event, eq(event.id, workoutSession.eventId));
.leftJoin(
workoutResult,
eq(workoutSession.id, workoutResult.workoutSessionId)
)
const qb = db
.select()
.from(workoutSession)
// .leftJoin(event, eq(event.id, workoutSession.eventId));
.leftJoin(
workoutResult,
eq(workoutSession.id, workoutResult.workoutSessionId)
)
I don't understand why workoutSession.workoutResult is not an array, since there are many workoutResults with the same workoutSessionId I hope I'm clear enough. I've also tried adding the .all() at the end of the query, but this does not seem to exist anywhere in drizzle 🤔
23 replies