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

Best database for a social network if starting from scratch today?

Database Gurus, I’d love your advice! I’m building a new social network that has a combination of a feed/wall and a Discord-style chat. What database would you recommend and why? Eg. SQL, noSQL or a combination of the two and what types eg. MySQL, DynamoDB etc

Edge Server Actions

How can they be configured in server actions? ```ts "use server"; import { revalidatePath } from "next/cache";...

Component re-renders after state change, tRPC query not executed again?

I have a component where I render out a table. Each row has a checkbox. Each checked row can be deleted. I am using tRPC to query and paginate the data in the table and also to delete the rows using Prisma. After deleting the checked rows, I want the table to re-render and display the items minus the ones previously deleted. Everything tRPC-ish works (I think). The component get's re-rendered after the mutation, but I the table only get's updated after I switch windows (i.e. bringing VSCode in the front, then back to Chrome). What is causing this behaviour? Am I missing something using on the tRPC side of things?...
Solution:
trpc doesnt refetch on rerender

create t3 app for nextjs 13.4 app dir

Are there plans to update the boilerplate to use the now stable app dir in nextjs 13.4? If so, is there an expected date for this?

Next Auth problem in Vercel

I'm currently deploying my app in Vercel but it won't work because of the following error: ```TypeError: "ikm"" must be an instance of Uint8Array or a string at (node_modules/@panva/hkdf/dist/web/index.js:17:0) at (node_modules/@panva/hkdf/dist/web/index.js:21:0)...

TS saying I have no ID when I do?

I'm working on a postgres next auth adapter. Here's my schema: ```export const accounts = pgTable('accounts', {...

Next.js : Get server component data in client component

Hey, I'm trying the new app dir. It's pretty good, but I'm not sure how to get data from a server component and pass it to my XState machine? 🧐 For now the only way I found is to do it like this ```tsx // layout.tsx...

implementation of push notifications

Hi, I am trying to implement push notifications and read through a few Firebase Cloud Messaging tutorials. The concept is 1. get notification permission and generate a token 2. send token to server...

good object/block storage service no card no phone

Need good object/block storage service no card no phone like Amazon s3

How to create an object with a mutation. Getting React error `Invalid hook call`

Hi, would be great if I could some help here šŸ™‚ Here is my userRouter, getAll already works without issues. However I dont manage to create objects in my database. ```ts import { createTRPCRouter, publicProcedure } from "../trpc"; ...

Can someone explain the difference between page router and app router?

create-t3-app is using page router at the moment as far as I can tell, but the app router seems to be the latest thing. What's the difference? Should I switch? When do I switch? How do I switch? Does it even matter? I suppose it's not that important as long as create-t3-app is still using page router? Please excuse me if these are stupid questions lol...

Setup pub/sub connection in Next.js

I have a t3-based next.js app, and a separate server for running various jobs. I can send jobs to this server with BullMQ and Redis, but how do I send data back to the next.js app? I need to set up some sort of listener or webhook. How are these things done in Next.js? I must admit, the "serverless" nature of next.js is a bit of a question mark here and I am wondering if I should drop it completely.

T3 hydration mismatch - div in div

After following the T3 0 to prod, I tried setting up a new similar project. It is pretty much identical, although I stripped it of the posts and profile endpoints and pages. But I'm currently getting this, and cant figure out what is going wrong with hydration (ref image). How do I figure out what is causing this issue?

Is there a onRegister handler for NextAuth?

Hi folks, how would you go about creating a onRegister function on NextAuth for new users? Their documentation does not have this, I don't know why. I want to generate some data on DB whenever a new user is logged in for the very first time...
Solution:
have you looked at the createUser event? https://next-auth.js.org/configuration/events#createuser

Why is my page considered Ī» by next.js?

I have a page, that fetches content from storyblok CMS, the function that fetches the story is fully custom[pic 1]. I have added cache: force-cache in fetch function that is inside fetchStory function, that is called in the page.tsx [pic 2]....

Looking for TS Tanstack table resources/tutorials

hey guys I'm having trouble using tanstack table in my create-t3-app does anyone have any resources/tutorials to share

SWR - If loading is false and error is undefined, what can we assume?

If isLoading is false and error is undefined, can I assume data is not undefined? (using typescript) Is it ok to always have to use data like this data?.something (since it is possibly undefined). Is there a more standard way to know for sure when data is ready to be used on the UI? Should I always do something like data && <Component/>?...

Infer nested type of trpc router return type

I have a tRPC router than returns a nested object through a db query. It looks like this: ```ts ILessonCommentProps.comments: ({ _count: {...