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

Noob Question

Please tell me a better way to do this if u know of any? Is ternary only option?

Redirect If Not Authed Pattern

Hi, is there any reason that it's not good to use the following pattern to gate pages? `export async function getServerSideProps(ctx: GetServerSidePropsContext) { // Redirect to Landing Page if Not Logged in return redirectIfNotAuthed({...

Any recommended color picker for react?

Using MUI but open to any kind of color picker.

Postgres docker image with database creation?

Currently I am struggling to have a postgres docker image which automatically generates a database. Doing this right now ```ts version: '3.3'...

How should I organize my app where it has different behavior in responsive layout?

(Screenshot) for example Modal on Desktop vs New Page on Mobile.

Next.js + GraphQl

Hi guys I am new to coding and start to understand the front end structures and how to build it with React or Next.js. My question is now: would it be a good idea to use graqhql and typescript together with Next.js? What other options are popular/ a good idea?

How do you handle loaders and 'flash' with TRPC?

Hey 👋 I'm working with the T3 stack and I'm bored about loaders everywhere. When the data is not cached, I need to show a loader or a skeleton for ≈ 1s, it feels slow and there is a lot of "layout shift". I didn't find a way to avoid them. Is full SSR the way to go? How do you handle that?...

Tabnine vs Copilot for fullstack development

Have you peeps tried these tools? What are your thoughts? Are they worth the price?

Optimal way to reuse a modal for create and edit. Eg - create task and edit task.

I'm using react + react query and I keep finding myself creating several modals without much reusing of components. Upon refactoring my code a bunch, I am currently doing the following - For the purpose of the example, let us take 2 modals - one for creating a task and one for editing a task. Let's say tasks only have 2 fields - title and due date. What I currently do is - ...

Handling duplicates with trpc

Lets say I have an User in Prisma database that has a Coin[] array in his model. Currently I'm doing something like this to display table of all items: ``` // Create an item .mutation(async ({ ctx, input }) => {...

Trying to get TailwindCSS working with Next13

So I am trying to get TailwindCSS working with NextJS 13. I've tried following all the steps from the docs(https://tailwindcss.com/docs/guides/nextjs), still no dice. Also tried following this SO thread(https://stackoverflow.com/questions/74259178/how-can-i-apply-tailwind-css-in-app-folder-in-next-13) including moving global.css file from ./app to ./styles. And then even tho it's not mentioned in the docs, I'm running npx tailwindcss -i ./styles/globals.css -o ./dist/output.css --watch since that seems like it might need to happen given some other docs I've read....

next language server plugin not working

when setting up nextjs with --experimental-app it sets up a plugin in tsconfig.json
"plugins": [{ "name": "next"}]
"plugins": [{ "name": "next"}]
Which gives some additional nextjs specific typings inside certain files....

passing object as a props, how to type it

Heyy lets say I have fully typed object from a backend on a page like this
const { data: getCoin } = trpc.coin.getCoin.useQuery({ name: id });
const { data: getCoin } = trpc.coin.getCoin.useQuery({ name: id });
His type looks like this ```symbol: string; name: string;...

solid start routeData errors

reposting here cause got no help in solid server yet

Is putting the session into the context really a good idea? (overhead on each request)

I was just wondering about the default way of session handling. Looking at the docs, the session is put into the context: ```ts // server/trpc/context.ts...

basic js logic question

I have x2 arrays: QuestBotGuildIds = an array of Id’s from my db. UserGuilds = an array basic guild information for every guild. ...

Module augmentation - Typesafe Electron IPC

Hey 👋 I want to extend the Electron type definitions to make the channels for IPC communication more typesafe. For this, I'll need to override the types of the class BrowserWindow. Only the types, the underlying JavaScript will be the same. The problem is, I can't figure out how to override the electron module type defintions without running into Duplicate identifier or Cannot redeclare block-scoped variable....

dev server suddenly stopped working

I was working on my application and it stopped working

Xata can be a good alternative to Planetscale Serverless?

Planescale is a serverless database recommended in the t3stack docs. Xata codegen seems like giving better generator of database code than prisma, also allow table relations thing that Planetscale don't allow, and have integrate search and analytics functionality. Does anyone know a comparison between these two serverless databases? Xata pricing is cheap? Xata is ready for production or we should wait a few months first?

tRPC and existing api

Hello, I have external API that I use on my project. I need to hide my api key so I need to create api routes as wrapper (to run serverside). Could I just use trpc for it instead of the normal api route way on nextjs? So on trpc get external api and return result and client fetches from trpc