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

Prisma with kysely

Hi, I am using prisma to create schemas and some queries. I know prisma can be slow in serverless function so I was thinking to use kysely for the queries that need the speed. If I have prisma in the trpc context and do not use it will it create a connection? I think not but I want to be sure. So if in some functions I use kysely to query would it make a difference?...

Passing data as props in form function

Hi fam how can I pass props on a form function below is my form function ``` const handlesubmit =(e:React.FormEvent ) =>{ e.preventDefault()...

Prisma model change without data loss

I am working on a t3 project and currently only have one database. I want to change the type of a column in a model but when trying to use db push I am asked to reset the database. After looking around and asking Chatgpt, I tried using Prisma migrate dev but I am given a similar message about my Prisma schema not being in sync with my migration history and am again prompted to reset the db. Is there anyway I can fix the drift and make changes to the schema without resetting?...

How to set default options on trpcs react query wrapper

Is there a way to i.e. disable refetchOnFocus by default other than setting it on each query?

Scalar Lists in PlanetScale not supported

I would like to use scalar lists but as of now PlanetScale doesn't support this. Is there a way I can achieve this functionality or any workarounds anyone knows of? ``` model Example { id String @id @default(cuid())...

Tailwind Intellisense - WebStorm

I hope this guide will help webstorm users. WebStorm version - 2023.1 , Tailwindcss - 3.3.0 ...

Webhooks correct terminology

Context: I am working on an app, I need to be able to explain this to the rest of the team and not get myself/others confused. Scenario: I registered a "thing" on a service that sends POST requests to an API endpoint on my server when certain things happen (a webhook?). When my server receives this request, I write the data from it to my database and respond with 200. ...

slow switching btw pages on app dir

I have loading components but they doesn’t appear when I click to navigate to other pages. They appears only when I have switched to the page for the second time. I put 3g connection on the test to show it more clearly

Data management paradigm

Hi. I am developing a web app and I want to know your take on data management. * Is it a good idea to fetch and write data from/to database (document one, so no prisma here) on server component and pass it? Or should I do it on its view component? Can I benefit from nextjs13 fetch with firebase api? I want to do a good job on security, performance and efficiency (to avoid unnecessary costs) so any tip using nextjs and t3 will be appreciated 🙂...

Testing web apps with this JS framework

So i'm doing some contract work and need to test some small web apps. They are built with the jsPsych framework and bundled with Webpack. I don't know how to test these apps since I have no access to the UI. Here's an example of what I mean: ```import {initJsPsych} from 'jspsych'; import htmlKeyboardResponse from '@jspsych/plugin-html-keyboard-response';...

WebSocket connection authentication

How would you authenticate a ws connection? I was thinking about sending the session token, but I'm not sure if that's secure. Moreover, I'm haven't found an easy way to get the session token, apart from querying the DB. Any ideas?

Next-auth/Clerk for single user?

Is it still advised to use auth solution for a single user?

Eslint bug or am I missing something ?

Please can someone tell me why am i getting this error : even though my function is equal to : const onSubmit = (data: IQuestion) => console.log(data);...

dockerizing typescript

I would like to be able to build my typescript app into a docker file which I can push to a private registry and then pull on my server so I can manage the process easier. What registry should I use? Can I deploy docker files on Vercel if I have a web app inside it? What do I need to do differently for a turbo repo monorepo?...

Sanity integration.

I want to add sanityV3 to my T3 app to allow internal members to quickly write blogs. I followed this repo - https://github.com/sanity-io/nextjs-blog-cms-sanity-v3 I am using nextjs /pages setup with sanity v3. I can't figure out how to solve these errors....

Does anyone know of a nice starting template for a React component npm package?

I want to make a React component and publish it to NPM but cba setting it up myself and invent the wheel again. Is there a nice starting point for this that I can use? Needs TypeScript of course. Maybe Vite or something for dev.

clerk on localhost not working

I am following Theos tutorial on the T3 stack. Everything works in production, but on localhost, seemingly out of nowhere, it seems like Clerk is giving me an expired token which leads to no data getting fetched. This only happens in localhost and after I am signed in. There isnt any difference between my code and Theos from the video. Any ideas whats wrong?

'use client' directive throws error

Steps: 1. npx create-next@latest 2. accept app dir usage 3. create client component with 'use client' directive at the top 4. import and use client component in default home page...