Theo's Typesafe Cult

TTC

Theo's Typesafe Cult

Join the community to ask questions about Theo's Typesafe Cult and get answers from other members.

Join

Recommendation for Tiny CSS Library

Can someone recommended a tiny CSS library to add simple styling to a demo app? Something along the lines of https://picocss.com/...

React Query: useQuery

So I am trying to implement pagination with React Query. Been reading a lot of docs and examples. In many examples, the useQuery data has a "hasMore" property. I don't have this..? When I log data, it's not there. So is there any way for me to know that the next page is the last page..?

Managing data fetching in Astro

How do you guys manage data fetching in an astro SSG website. I have some pages which will reuse content (currently fetched from a CMS API). Should i add a fetch statement at the top of each component or breakup the data into another folder and import it from there while creating some utility script to refetch new data? Any good pointers on how i should approach this problem?...

Modifying Next Auth in T3 App

I've recently launched a T3 app and some users are having trouble authenticating through the Email provider/Magic Link when using a corporate email address and Microsoft Outlook. I've searched online and the docs and come across this fix: https://authjs.dev/guides/corporate-proxies/avoid-corporate-link-checking-email-provider...

Prisma + Planetscale TLS/SLL error

I don't really know what is going on. I can do
npx prisma db push
npx prisma db push
...

Prisma `clientExtensions` Preview Feature Breaks Types

Enabling the clientExtensions preview feature in prisma.schema causes trpc routers to break all typesatefy. Anyone mess with this yet?...

Role based Authentication Question

I was looking to have an isAdmin middleware like option 2 here: https://trpc.io/docs/authorization However, my "role" field that isn't available in my context. How do I add it to my context? Sorry if thats a dumb q im new lol...

How to manage cookie preferences with Nextjs SSG?

I am trying to setup a compliance banner and preferences menu for GDPR. Haven't been able to find a proper good example... seems like there could be more moving parts than just "store a cookie" Any help is appreciated. ps. It should only show when a user connects from the EU / GDPR enforced countries...

How to create TikTok Style App with WebApp?

Hello, I'm looking to create a tiktok style app, meaning users can access videos on the web-app, but also download the app to access them there (keyword: deep-linking). The experience in the web-app is somewhat different (as you can see on the normal tiktok page, it wouldn't be fullscreen and there would be creator recommendations on the sides). With these considerations in mind, here are my thoughts: - Use create-t3-turbo to create a next + react native app...

canvas.node

Being on this canvas.node errors for some hours and i have tried so many solutions but yet, nothing is working. `node:internal/modules/cjs/loader:1203 return process.dlopen(module, path.toNamespacedPath(filename)); ^...

a question for all the vue devs

how do you define props? do you use the special typescript syntax: ```ts const props = withDefaults(defineProps<{ active: boolean }>(), {...

Is trpc's isr (ssg) worth it?

I have an application at https://judge-devs.vercel.app/. Projects single page (at /project/[id]) is using isr as trpc recommends it and i have users single page (at user/[id]) which uses "bare" isr and users single page significantly loads faster. So the question is why would I use trpc's method when i can achieve faster loads without using it? What are the benefits of using isr as trpc recommends it?...

error - ReferenceError: Cannot access 'createTRPCRouter' before initialization

Anyone ever experience an error as in title of this Q. src\server\api\root.ts ```import { createTRPCRouter } from "./trpc"; import { exampleRouter } from "./routers/example";...

tRCP can I subscribe to a query?

hi everyone! is there a way of subscribing directly to a query and or invalidate a query directly from the tRCP router? I am using create-t3-app + NextJs + Prisma (pg) Thank you in advance!...

Resources to use work training budget

Hi all, I get a yearly budget to use for training and I’m not sure what to spend it on. Does anyone have any recommended resources or courses that are paid for? Happy to hear about anything; I’m a mid level front end engineer looking to go more full stack so something back end focused would be cool. If i can’t find anything I’ll probably buy a copy of Refactoring UI....

sync realtime DB ( or query sub) to global store

Hey 🙂 I am doing some realtime experiments (nextJS + Supabase or nextJS + tRPC) . In general, have my basic queries/mutations/subs up and running but because the data can/will be used within different components I feel the need of syncing these values into a global store ( Recoil or Redux). Which way do you think it would be best? I am thinking to create a global data wrapper provider but I wonder how scalable this can be and if there are better solutions....

Nextauth Credentials provider

I setup up the Github provider and added the Credentials provider to login with an email and password. The Github provider works fine, but now I tried to add the Credentials provider with jwt, but I can't make it work. Currently I get this error if I try to sign in: ```ts...

NextAuth user in middleware

Hi, I want to get user in the middleware so I can do conditional redirection of the users that don't have specific property yet defined. Like an onboarding screen. How can i get user in the middleware to have something like this: ```ts export function middleware(request: NextRequest) { const isUserOnboarded = sessionData?.user?.isOnboarded; ...

JWT and refresh tokens

I need some advice on how to handle refresh tokens 😦 Is it "good enough" if I generate two JWT tokens (accessToken, refreshToken), and let the resfrehToken just contain one claim, being the userID? And whenever I do a api call from the client and it returns a 401, I then call a /refresh api call, to get a new accessToken and retry the request - as long as the refreshToken is valid?