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

where to learn about FE performance/optimizations?

I feel that Iโ€™m fairly advanced on regular FE development (building our features on a daily basis), but not feeling confident about tracking performance, optimization techniques etc. Anybody has any suggestion where to start learning about this stuff? Or how to approach it? Like, letโ€™s say, weโ€™ve got a feature in a react project implemented in two ways - how to understand which one is more performant (faster/memory efficient, etc)?...

tRPC Mutation

Hi, I don't quite understand how to pass the input when using with useMutation Server: ```ts create: protectedProcedure...
Solution:
api.deposit.create.useMutation is a hook so you cant use it like that it expose a mutate function, so you can use it to actually send the data to the server, something like ```ts const Deposit = () => {...

Why is the value type of `_opts` in createInnerTRPCContext never?

I am trying to read some cookies and then add a boolean flag to the context that I need on every request, but when trying to read _opts, its type is [x: string]: never. Any idea why this is? As far as I understand it this should have the request and cookies on it. Thanks!...

Secrets management tools with T3 stack

Does anyone have experience using secrets managements tools that integrate well with create-t3-app? I would like to start using either vault or infisical, but I don't know if that would mess up the secrets validation with zod

prisma ctx not recognizing types after schema update

I have been working with create-t3-app and have stumbled upon something that I might not be doing right so I'm trying to check here to see if I'm missing a step in the process or what could be the issue. I have initially created a schema for my app for prisma, but the problem is every time I go back and update it, push it and generate the typescript files, I get this weird message all the time unless I delete the .next and node_modules folders. Do you guys have any suggestion on to why this is happening or how can I manage this? Any help is greatly appreciated!...

I have spaces that can have many members and one author how do i define my schema

this is the current schema but i think the index for spaces should not be author ID

React Native and Zustand Real-time data

Hey everyone, I am writing a react native app that uses mqtt for real time data comms, and needs to be able to update every 100ms if possible. I am using zustand to handle the mqtt data outside of the react tree to help reduce uneccessary renders....

What is the backend that runs the server side of NextJS?

This seems like a silly question, but I can't find the answer anywhere. Is the server side of a NextJS app running ExpressJS or something like that when running locally or deployed to Vercel ? I am trying to make the case for using the T3 stack for our next project, but our CTO is against ExpressJS. We run everything in docker images with NGINX, Frontend (react or soon nextjs), Sanic Web server (Python) all in a kubernates cluster. My goal is to simplify the stack and reduce the AWS expenses....

How to handle invalidate queries

Hi guys! how do you handle invalidate queries after a successful mutation, what I did is I added a invalidate call to my onSuccess callback in my mutation. This does invalidate my getAllProjects query, however it takes a little bit of time to load. Do you have any suggestions how I might be able to add a loading state while the invalidation happens?

Tailwind Truncate Messes With Layout

```<div className="flex min-h-screen min-w-screen bg-zinc-700"> <div className="max-h-screen flex-[2] border-x border-solid border-black flex flex-col relative"> <div className="flex-grow-[10] h-[85%] flex flex-col items-center p-0 m-0 gap-2 pt-2 overflow-y-scroll hide-scrollbar"> { ["๐Ÿ“Š Statistics", "๐ŸŒ US History III", "๐Ÿ“˜ English III",].map((b, i, a) => (...

Separate T3.gg backend and frontend modules with different dependencies?

I am not a js packaging expert by any measure, but curious if that's the natural direction to go for managing dependencies. Since the package.json is shared, I assume that the same dependencies are imported by my frontend even if I were to add a dependency used solely on my backend? Does that make the FE less performant?

deno/supabase edge func: so many typescript lint errors

i dont want to disable typescript errors, actually want to fix this do i need to make a change in tsconfig.json or .eslintrrc.cjs to fix this? a little lost on why so many errors are popping up can also see me tree structure in pic. the supabase folder is at root, outside of src...

Can I split trpc router so some of the endpoints are on edge and other on nextjs?

Should I create another endpoint something like [edgetrpc] and have seperate instance of trpc there? What is the best approach?

TRPC + Prisma Caching

Hey. I'm using trpc middlewares to inject the authenticated user (from the db using prisma) to the procedure's context. each request makes at least one DB query and thats expensive. i already have a redis database for other reasons and I'd like to introduce caching of users. the point is that the application is heavily dependent on the user so it is not acceptable to get outdated. my idea was to use redis with the key of the userid and the value is the the user data. when there is an entry in the cache, we use that instead of the using the db. on any kind of user update, we remove the that users entry from the redis db. what do you think about this approach/strategy?...

[Expo Router] Tab and Drawer Navigation together

Does anyone have a working example of using drawer and tab navigation together with expo-router? There is nothing in their docs really and cany find any examples online. The _layout files are messing me up and i cant figure it out. I want 4 tabs on the bottom, with tab 1 and tab 2 also rendering a drawer that is unique to each tab....

NextJS Types & Intuition in T3 App

Hello, I recently wanted to make a REST API using the T3 stack and the OpenAPI tRPC adapter. I'd also wanted to use T3 in other projects because I simply love the stack and know a fair bit about each respective layer except for NextJS. I have familiarity with multiple other (meta) frameworks, like Svelte/SvelteKit, Solid, Astro, and React, but Next always trips me up. I tend to learn a framework through its types, and the NextJS types/patterns are somewhat confusing to me, especially with the NextJS 13 transition and React Server components (hence why the deep questions tag; I know the goals Next wants to achieve and how they're achieved in other frameworks, as well as the basics of how they're achieved in Next, ie with getStaticProps). I have two questions, one vv specific and one a lot more general. Firstly, I'd like to know what the purpose of some of the types used in the starter + tRPC + Prisma + Tailwind T3 app are. I've tried googling/asking chatGPT in a ton of different ways, but I can't seem to find an explanation for these types. Here they are below, with question annotations in comments:...

Auth0 Problems within T3 App - ID Too Long

Hey there, I am having some issues with auth0 Provider in ct3 using the prisma provider generated. I added the auth0 provider but now I am getting this error anytime I use the sign in button ```...
Solution:
I feel dumb Tropic ensure you read the notes next time...

any tips for implementing Google maps, open layers, or open maps?

I've unsuccessfully tried to add a map to a page. Does anyone have a good example?

Should I look into using linked lists?

Hey guys I have a data structures question kinda. I am building an offline electron app that's using SQLite as the database. I am going to have 3 tables in my database. Each of these tables will hold 1000 items each at max. right now as things are I'm just fetching all the items and storing them in a typical array and printing them in a table. I'm working with TypeScript. My question is that should I look into implementing linked lists for speed and such? Sorry if this is a stupid question or if it doesn't make sense. I'm going to be learning linked lists and data structures in general soon so not fully sure of the advantages and such just yet....