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

React telling me an error is unhandled incorrectly??

how am i not handling the error? Also, how do i get the e variable to have the correct type?

Quick question on concept

does the implementation of TRPC replace getStaticProps in nextjs. getStaticProps. I just havn't seen getStaticProps anywhere in the example T3 stack project. "Essentially, getStaticProps allows you to tell Next.js: “Hey, this page has some data dependencies — so when you pre-render this page at build time, make sure to resolve them first!”"....

Storing Account Usename With Next Auth

I'm looking to store the username of an account when they sign in i.e ```typescript model Account { ......

Database Design for API

How would you guys go about designing a table/api for something like a form builder for a specific purpose. For example I want the users to be able to add inputs etc, and right now I just save these as json in a json column for each form type created by a user, however when it comes to types, this isn't so convenient. So I was thinking of possibly just making the form inputs to be stored as a list of json, where each input would have { name:"", Value:"", Type:"", Validation:"" } and then just parsing the json array into a form and to store it's values. Almost like EAV style, but per a row since we have json columns now...

prisma folder and db nowhere to be found in docker container

I am using the dockerfile from the t3 docs, everything builds fine, but I can't seem to find the prisma folder which should have the schema and the .sqlite db Start of docker file ``` ##### DEPENDENCIES...

Is it possible to send a progress status with tRPC?

I have some tRPC mutations that take a while 20s+ and would like to give the user an idea of how far along it is. is there a way I get send back some data to the client to show the progress?...

Protecting static site data

Hey I was wondering if It's possible to protect a hard coded react / html site. If the site source code can be read / modified by users. What Is the purpose of making login forms with email / pass if it can be bypassed easily (by people that know smth about web)? Is there any way to not let users see a hard coded site?

tRPC + WebSocket Client

I have a WebSocket between my backend and an external server. I'm trying to get to this:
WebSocket Server → Next.js backend → users
WebSocket Server → Next.js backend → users
I have gone through tRPC's documentation on subscriptions (https://trpc.io/docs/subscriptions) and a few examples, but none seemed to work the way I need it....

tRPC + React Native (Expo)?

I've been doing some research on tRPC in the last couple of days and I really like the technology. The question I have is, what if you have a Next.js project and a React Native (Expo) app sharing the same backend? (considering that the backend would live inside the Next.js project). Should I use tRPC, or in this specific case it would be better to use something like Rest so it's easier to spread the backend to different clients?

VSCode - prevent annoying highlighting

VSCode will do this thing where starts highlighting when entering props and it sometimes breaks autocomplete, I have no idea why it does that or how to stop it. Anyone know how to turn this off in VSCode?

Docker is failing on openssl1.1-compat

I am trying to build my t3 project, but I get these errors ``` #8 2.590 ERROR: unable to select packages: #8 2.619 openssl1.1-compat (no such package): #8 2.619 required by: world[openssl1.1-compat]"...

dynamic segment in next

hi, im trying to create a dynamic route in next with a sub page but i keep getting a 404. See picures provided. What am i doing wrong?

Angular - What about a t3 stack for the angular side

Don' be triggered by this post but... it would be cool to implement this type of “stack” not only for react (t3) and vue ecosystems (sidebase) but even for angular, and it could work! 🧐🧐 Maybe someday a lot of developers could have multiple choices using this type of stacks, even if they use different frameworks or libraries for the frontend side, to use most of the full type safe ecosystem...

Is it possible to use string interp for width in tailwind

is it possible to use $w-[${x.width}px] in tailwind?

Best way to implement a cart?

I've implemented a cart using jotai's atomWithStorage to save the items in lcoalStorage, but I was wondering if I should store the cart in the server instead? In this specific app only logged in users can access the store. Are there other better ways of implementing a cart?...

AuthSession in T3 boiler plate not working when fetching data in SSG with tRPC

So when fetching data in getStaticProps, the docs instruct to use the SSG headers https://trpc.io/docs/ssg. Now doing this causes the file in server/common/get-server-auth-session to throw errors because the context will be undefined. What's the way to go around this

How to use useQuery...?

Uber noob question here, I seem to have a misunderstanding of useQuery. Here is all im trying to do - use it to return an array from my database, console log the data. Here is my component, when it loads it doesn't log anything (because getAllCars.data hasn't resolved yet?), as if I need to await the data (what is the pattern for this in TRPC?). If I wasn't using TRPC, I would have the cars data set to a state so I can put the loop inside a useEffect with cars state as a dependancy, however I understand the TRPC patterns are different. Looking at the useQuery docs, the useQuery example doesn't help. The data just seems to be there? Anyway the solution is presumably. very simple, hoping someone can point me in the right direction...

Custom field name or rename field in model for NextAuth.js (Prisma adapter)

Hey! I'm not a fan of fields named id, but rather like to have speaking names like userId or postId, which makes the code easier to read imo. I'm using the Prisma adapter and added all needed models to my schema. In the User model, I would like to use a field name userId instead of id. Is this possible?...

React is saying a function can not be passed as a child

Hello, I am trying to render a list of components on one of my pages, however when doing so I am getting the following error: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it....

Why should I use React Table ?

I just watched this video https://www.youtube.com/watch?v=aFCxPo0kOGk however even after watching it and reading the docs I still don't understand... Why should I use RT instead of just copying the source code of a table from some Tailwind component library and just changing the header and row data? Is it simplicity, rendering efficiency, or smth else?...