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

Tauri - the Electron Alternative - do I have to write any Rust code to use Tauri?

It seems that most of the APIs provided by Tauri are in TS/JS. Why can't one turn a website into a tauri app the same way one can turn a website into an Electron app with one click?...

Cancel current outgoing mutation when sending new one in create-t3-app?

I'm working on a project which uses optimistic UI updates when a user initiates a trpc mutation (so, e.g. as soon as they click a button to edit a piece of data, the corresponding data in the cache gets updated synchronously, and then overwritten by fresh server data once the request completes). Have tried to follow the patterns here, and it's been working pretty well: https://tanstack.com/query/v4/docs/guides/optimistic-updates The only issue I have with this approach is that, if the user is initiating multiple mutations at once this can lead to race conditions (e.g. there's one button which sets a value in a database to equal 1 and there's a different button which, set's that same value to be 2. If the user presses both buttons in quick succession, then whichever of the two requests resolves last will become the final result....

trpc response time

I have a situation where I need to record the response time of a request. If I wasn't using trpc, I would just record the start time, await the response and record the end time. Is there a way to do this, while using trpc?

TRPC type issue

I have a typing issue which I don't understand, I have this trpc create method ```ts create: t.procedure .input(createFileSchema) .mutation(async ({ input, ctx }) => {...

Nextjs detect previous route

Is there a way to detect if the user is going back to a previous page? Right now I am doing this which does not work always, seems like it does not work for nested routes not sure if there is a good solution ```ts export default function MainLayout({ children }: Props) { const router = useRouter()...

Authentication with Credentials with Create T3

Hi! Has anyone done a project using create t3 then used credentials with NextAuth? I found a tutorial online, but it seems to do things pretty differently from the way they would be done in the create t3 scaffolding. For reference this is the article that I was looking at, https://dev.to/franciscomendes10866/nextjs-authentication-with-next-auth-trpc-and-prisma-kgl. I tried to add/configure from this project to the create t3 scaffold, but I didn't have any success....

accessing client side storage in next13 react server components

i'm trying out nextjs 13 and using their new routing. i have a page and loading component. i want to use localstorage/cookies/anything i can store on the client to get the user's session to get data in the page component. to do this i would have to switch to a client component which defeats the purpose. is there a workaround?

Turbopack + Electron

Could I use Turbopack to bundle an Electron app?

Handle specific tRPC errors centrally

I would like to handle some errors of all of my queries centrally. e.g. I would like to have an 401 error always be handled the same way -> reroute the user to my login page. So I would like to prevent adding an onError func to every query I'm doing in my client. Is there a way to do that? ...

is this a good way to implement search functionality

i feel they will be a better way....what i am trying to do is to display a normal query then when input is provided it uses it to for the search

When using T3 with react-native, what Auth-lib would you recommend until `next-auth` supports RN?

Hi there, it's my first post on the server, and I'm excited to be here! 😄 I am using create-t3-app at work in production with great success, and working a side project using react-native. How do you guys make authed requests with tRPC, when next-auth is currently not available on RN?...

Can't access two tables through prisma client?

I have two tables in schema.prisma, but whenever I do prisma. I can only access one of the tables but not the other..?

Theme naming

Hey so I'm looking to build a little ui kit / design system for my personal projects and I'm wondering what approach I should take re. colors I was thinking something like daisyui https://github.com/saadeghi/daisyui/blob/master/src/colors/colorNames.js with a primary, primary-focus etc...

inheritance with prisma

I had a question similar to https://discord.com/channels/966627436387266600/966786610362474576/1017109977036492930 , except mine is at the model level and not table. that is, if I want to retrieve a list of items from the Apple table and Orange table which has shared properties like "id" and "type" although type would be unique to each respective table like granny smith and red delicious for apple and navel and tangerine for orange, I was wondering if there's model-level support for this. I can...

Per-Page Layouts in T3

Hey guys I was attempting to implement per page layouts on the t3 starter template as shown here: https://nextjs.org/docs/basic-features/layouts#with-typescript I kept running into Typescript issues. Any way I could go about this in a way I could make Typescript happy?...

500 error on api call RAILWAY

the frontend app starts but it doesn't connect to the right url of the api it gives me 500 error.. the url of the call on the right is not right.... thats the url of the same site, like it's calling it's self but i setted up the env var for the api calls right...

Implement Recurring Meetings

I am working on a (slightly more than) meeting management app. I want to implement recurring meetings (as in every week, every day, etc). I am not quite sure how to go about it though. Should I just store a start time, duration, and the interval and simply derive it when I need to? Or should I store a start time, end time, and duration and have some form of scheduled event that actually updates the DB? Maybe something else entirely? I do also need some other actions to be done after a meeting finishes. ...

tailwind intellisense

Have not been able to get this working for the last day on any project using any config. I feel like the issue has to be with my vsc or some other extension causing it to crash

Application Error, app not listening on $PORT?

i uploaded an app with the railway cli and setted the env variable called PORT, but it's still broken..

Sign out (redirect true) in Docker

So I have this problem where I want to use
signOut({redirect:true})
signOut({redirect:true})
and let's say that NEXT_AUTH_URL=localhost:3000...