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

Graphql schema first or code first ?

Im currently building an app, for something i will use but as an hobby, using NestJS, GraphQL and Prisma. I have read about both approaches, and i find the schema first very interesting because it allows everyone to understand the API whatever language is used on the backend. Since im using Typescript and I will be working, I was wondering if the code first approach wouldn't make me write less code specially because Nest has a plugin that allows to not use decorators on every property, which mak...

how to extend a model

So basically i have a few models but the model is been reused but i want to manipulate it to add some more values

getting a server response without metadata (config, header, request, status)

When I make a request like this (screenshot1) I always get a nested data object along side config, header, request, status, statustext (screenshot2) That has been fine so far, but now that I have a paginated response that I'm getting via React Query useInfiniteQuery(), I get multiple data objects nested within each other on subsequent pages (screenshot3) ...

Next auth try signing with a new different account

I tried to make login functionality with google sign in but it's saying "try signing with a new different account" all the time

How to use yarn in create-t3-app ? [SOLVED]

Just started discovering t3 and noticed that it ran npm install in the initialization part. what's the way to install dependencies with yarn?

react - submitting form from parent or sibling

hey all, I am struggling to implement a design that has the submit button for a form essentially in the parent. the markup essentially boils down to something like: ```ts...

Presigned URL set acl?

I have a presigned url logic which uploads files successfully to my s3 bucket, but right now I can't view those files, I am getting an acl Access denied error. I am wondering how I can set that policy in my presigned url logic so far I did this without success: ```ts const conditions = [{ acl: 'public-read' }, ['content-length-range', 0, 10485760]]; ...

Component Library.

I've been thinking of making our own component library for our company. At the moment we style stuff with Material UI and we're moving over to tailwind. If I were to make such library should I take the path or architecture that Daisy UI uses ? Or is there an example that anyone feel fits better for an scalable library solution?...

Should I use JSON in MySQL here?

Im trying to decide how I should structure my data here. Im trying to move off of Firebase to Planetscale. I know that you can use JSON in MySQL, but I know you should avoid JSON if you can, especially if you wanting to index that data. But I do not need to index this data at all, im not doing anything special at all here. The Action Events is what I am thinking about using JSON for. I would store the actionEvents inside the possession table, and on the right-hand side in the picture there is a pretty typical example of what an actionEvents array would look like. ...

NextImage Revalidation

I have created an API path that returns a dynamic SVG and I am using Next/Image to render it on my landing page. It looks like the image has been cached and it does not revalidate. I checked the cache status by checking x-nextjs-cache header and I got STALE which means that the path is in the cache but exceeded the revalidate time so it will be updated in the background. However, it did not update. What it looks like: (look bottom right corner)...

What is the best approach to migrate to a new state management tool?

I have a project that I'm working on with bunch of people and redux is used for state management, it's kinda chaotic... What is the best way to migrate this thing to something more viable, like react query + zustand (if needed)? My initial approach would be to start implementing new features using react-query + zustand, and also integrating it when refactor of old code is needed....

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 - ...