Xanacas
TTCTheo's Typesafe Cult
•Created by James 2.0 on 11/23/2024 in #questions
App dir or Pages dir?
even though r19 is not yet released, RC is out for a while and GA is expected to be around the corner. So if you're building something new, on a new codebase, I'd give it a go. You could also use next14 and app dir, which uses React 18 - but the new next15 caching behavior should push you to v15 😉
6 replies
TTCTheo's Typesafe Cult
•Created by James 2.0 on 11/23/2024 in #questions
App dir or Pages dir?
pagedir will be supported for a while, but app dir is state of the art. If you're building a new project, almost always app dir is your choice.
6 replies
TTCTheo's Typesafe Cult
•Created by Reador on 11/21/2024 in #questions
NextAuth getServerSession used multiple time
If you're using v5, you'll be using useSession() as a hook on client side components and auth() on RSC, API Routes and Middleware. To my understanding you don't need to take care of any caching, this is done by nextAuth/AuthJS.
https://authjs.dev/getting-started/migrating-to-v5#authenticating-server-side
6 replies
TTCTheo's Typesafe Cult
•Created by Bored Student on 11/19/2024 in #questions
How to type react element arguments
const Example = ({guid} : {guid:string}) => { ... }
6 replies
TTCTheo's Typesafe Cult
•Created by Bored Student on 11/19/2024 in #questions
How to type react element arguments
react components only have one "parameter" which is props. this means you need to use object connotations. Const example = ({guid, something_else}: {guid: string, something_else: string}) => { }
or
Type PropsType= {guid: string, something_else: string} Const example = ({guid, something_else}: PropsType) => { }
Type PropsType= {guid: string, something_else: string} Const example = ({guid, something_else}: PropsType) => { }
6 replies
TTCTheo's Typesafe Cult
•Created by Xanacas on 1/4/2024 in #questions
Typescript bug or am I stupid?
Yes, it must be a scoping thing. However, I'm not using findIndex on latest_charge, but on disputes, so pi.latest_charge doesn't change while looking up my disputes.
4 replies
TTCTheo's Typesafe Cult
•Created by Xanacas on 11/5/2023 in #questions
How to get rid of this unnecessary code while preventing eslint from complaining.
"Since find() exists I rarely use findIndex()"
I didn't realize, that find create a mutable item whose changes are also reflected in the array. amazing 🙂
6 replies
TTCTheo's Typesafe Cult
•Created by Viszy A on 11/5/2023 in #questions
How do I fix this query, I was following a tutorial that doesn't use the t3 stack
+ if you're using a Server-Component in a Clientcomponent, all the data for the Server Component needs to be available on the request.
Means you must pass the server component from a server component as a child to the client component. Like this:
// server rendered page.tsx
...
return
<ClientComponent whatEverProps={...someData}>
<ServerRenderedChildComponent optionalData={...someData} />
</ClientComponent>
5 replies
TTCTheo's Typesafe Cult
•Created by ibamsey on 10/4/2022 in #questions
Multi-tenant - easy no?
prisma has a very early support for different schema
https://github.com/prisma/prisma/issues/1122#issuecomment-1231773471
88 replies