.traevelliath
.traevelliath
Explore posts from servers
TTCTheo's Typesafe Cult
Created by .traevelliath on 7/31/2023 in #questions
Prisma enum causes maximum call stack size exceeded.
Okay, It was fixed in 5.1.0, apparently.
4 replies
TTCTheo's Typesafe Cult
Created by Mj on 7/31/2023 in #questions
Help me not to give up on t3.
Why would you manually set data to cache? In your place, I would have waited until mutation is successful, then: await utils.posts.getAll.invalidate()
4 replies
TTCTheo's Typesafe Cult
Created by digeman on 7/31/2023 in #questions
Setting up and testing endpoints (for t3 stack)
it's achieved through webhooks. This 'another website' should send one to the endpoint you expose spicifically for this, then based on payload or type of event you can execute logic.
5 replies
TTCTheo's Typesafe Cult
Created by RevengeTime on 7/31/2023 in #questions
Prisma or Trpc for fetching data?
powerful trpc middleware.
2 replies
TTCTheo's Typesafe Cult
Created by .traevelliath on 7/31/2023 in #questions
Prisma enum causes maximum call stack size exceeded.
If you want to try for yourself:
4 replies
TTCTheo's Typesafe Cult
Created by .traevelliath on 7/7/2023 in #questions
Update userId which is used for defining relationships between models
I had to define onUpdate only on self-relations (teacher-students and student-teacher). So when I try to change first the id of the teacher then look for an old id in teacherId records, prisma throws an error saying that I violate self-relation.
4 replies
TTCTheo's Typesafe Cult
Created by zendev on 6/29/2023 in #questions
tRPC query gets the type right on the way in and wrong on the way out?
Not really. I think your way is okay, but as far as I can tell, isArtist and artistName both must be truthy for an artist in your app. So why have isArtist, when you can check for whether a user has artistName right away and thus, may be, get rid of this undefined issue?
6 replies
TTCTheo's Typesafe Cult
Created by zendev on 6/29/2023 in #questions
tRPC query gets the type right on the way in and wrong on the way out?
Why have 2 properties when you can have just artistName and check if the user has it, then filter them according to this check. This way, probably, you won't run into undefined.
6 replies
TTCTheo's Typesafe Cult
Created by dondonai on 6/29/2023 in #questions
React Query cache is not working?
What exactly is the issue? Cache is working, but you are manually requesting a refetch, so the data gets repopulated.
3 replies
TTCTheo's Typesafe Cult
Created by rasib on 6/29/2023 in #questions
Why does the official Twitter website look so different on mobile?
>Also, do you think they use state hook for the " ... " Collapsing of names and @handles? I think they use 3 simple css rules: { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
4 replies
TTCTheo's Typesafe Cult
Created by zendev on 6/28/2023 in #questions
Clerk - can’t get types of unsafeMetadata properties on user object?
Yeah, I mean when you set it in clerk dashboard, clerk has a hint on what type of data you gave it. But clerkClient, when you fetch from server, cannot not know if the data in custom metadata on a specific user on which it has nothing yet even exist. So yeah, manual assertion is the way I guess.
5 replies
TTCTheo's Typesafe Cult
Created by lecookie on 6/28/2023 in #questions
Admin dashboard
6 replies
TTCTheo's Typesafe Cult
Created by lecookie on 6/28/2023 in #questions
Admin dashboard
Definitely roles do need to be involved. Once you set them up, you can use getServerSideProps to redirect ( return {redirect: ... } ) or throw 403.
6 replies
TTCTheo's Typesafe Cult
Created by zendev on 6/28/2023 in #questions
Clerk - can’t get types of unsafeMetadata properties on user object?
AFAIK, clerk does not and cannot know, what type of custom metadata it would be. So you have to assert them manually with overloading or 'as string'.
5 replies
TTCTheo's Typesafe Cult
Created by .traevelliath on 6/22/2023 in #questions
Prisma 2-3 levels deep queries
tried all combinations of the above, same result. Guess I am to resort to .map()
17 replies
TTCTheo's Typesafe Cult
Created by .traevelliath on 6/22/2023 in #questions
Prisma 2-3 levels deep queries
yeah, yeah it does work. splendid. Although I receive a list with full user objects with this query. Additional 'select' inside 'friends' doesn't seem to be working.
17 replies
TTCTheo's Typesafe Cult
Created by .traevelliath on 6/14/2023 in #questions
Prisma query multiple tables
Okay, so: I have 3 tables with exact same schemas as per screenshot: Withdraw, Topup, Profit. I need to query them all 3 together, where userId matches with userId from current session and get rows ordered by 'createdAt'. Like this:
return await ctx.prisma.profit.findMany({
take : 5,
where : {
userId: id
},
orderBy: {
createdAt: 'desc'
}
});
return await ctx.prisma.profit.findMany({
take : 5,
where : {
userId: id
},
orderBy: {
createdAt: 'desc'
}
});
7 replies
TTCTheo's Typesafe Cult
Created by .traevelliath on 6/14/2023 in #questions
Prisma query multiple tables
yeah, it's almost what I was looking for. Unfortunately, I wasn't able to come up with a query that would let me implement pagination, so I wound up using prisma.$queryRaw and writing some SQL. Thanks anyway.
7 replies