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 Query refetch is refetching very slowly

So I'm running into an issue with react query where I am having to put an event listener which refetches the data to display. Essentially, we're using a 3rd party api to schedule meetings (Nylas), and their api is interesting, and requires you to attach a modal to the window. We are refetching the data when the window sees the modal closing. We know that the event listener is running due to a console.log. However, when we call the refetch function, the data doesn't update right away, instead, it will stall for a few seconds, and then eventually update. We know that the data is updated, since when you reload the page, the data is correct. Any ideas on what I could be doing wrong here? Should I be running a useMutation despite not owning the 3rd party api? Am I misunderstanding refetch? Thanks in advance!...

Recommendations for generating public api docs

Work wants to use something like swagger to show public REST api docs, any better alternatives? our endpoints arent openapi compliant I think anyways. would like to not force api design if i can get away with it. stuff like astro is cool but looking for something that requires less maintenance and more bring your own content like...

Prisma is not returning a type that has the property for the included relation

Hello, I am using prisma to query some data from my database where the name of the relatonship is data so the final record object looks something like this ```...

TypeScript powered settergetter of objects by path

Does anyone know of typescript powered alternative to lodash get/set methods where I can get or set value by a path to it and it will also autosuggest building path?

Know of any alternatives to tailwindUI?

Hey guys, I am looking for alternatives to tailwindUI, meaning design systems that use tailwind for the CSS and headless for the javascript/behaviors like headlessUI. Any other libraries such as MUI, Bootstrap, or ChakraUI that don't use tailwind out of the box are not an option. This could be good to have a free alternative for the community since tailwindUI is quite expensive and not everyone is willing to pay for it. I know about the libraries Theo talked about in this video: https://youtu.be/CQuTF-bkOgc?t=1057...

nextauth with next13 - invalid body

I've used basic guide and doc to incorporate nextauth and google as provider in my next13 app. I also have prisma with cockroach. When I use the "signIn" func of nextauth, I'm being sent to: "http://localhost:3000/api/auth/error" and it returns an error that says: "invalid body" I wrapped my main layout with the "SessionProvider" of next-auth....

Prisma is in my client bundle and I don't know why

When I use Next.js' bundle analyzer, I can see that Prisma (@prisma/client) is in my client bundle (see screenshot). Some information: - Prisma v4.5.0 & Next.js v13.0.4 - I export a prisma variable like normal from a single file...

No Overload matches this call with nextAuth mapping

https://snipit.io/public/snippets/74662 I am just trying to build a custom sigin form Only have email and Yandex auth provider...

GitLab refer to specific code in repo via code snippet

Is it possible in GitLab to refer to code snippet in repo via Markdown? I could find something in docs, but can't realize the correct syntax. https://docs.gitlab.com/ee/user/markdown.html#gitlab-specific-references...

How do I send sign-in links to New Users in Next-Auth, but disallow new registrations?

I am using the E-mail Provider with magic links in next-auth & I want users to be able to sign-in, when they already have an account, but not be able to sign-in when they don't: For new users, I want to manually check their applications and then send them a sign-in link. I am stuck as to how to do this though: The problem seems to be that sign-in & sign-up go via the same callback in next-auth: signIn(). There is no separate callback for signUp. Basically, what I want is:...

running tests in the t3 monorepo

So I have made a repo using the t3-turborepo starter, and I have started adding things, including vitest, but I am getting a bug
Error: Failed to resolve entry for package "@test/auth". The package may have incorrect main/module/exports specified in its package.json.
Error: Failed to resolve entry for package "@test/auth". The package may have incorrect main/module/exports specified in its package.json.
everything else works and here is the link to the repo https://github.com/dominikvrbic/t3-turbo

Is there a way to detect in the browser when the user connects a device to their machine?

Not without their permission, obviously, but it would be neat for users to be able to connect a device and have my app automatically detect it.

Asset load progress library

Hey all, Work is using a modified version of this https://github.com/Jam3/preloader to preload assets on our interactive sites. Is there anything more modern out there that we can use? Any suggestions? Basically I want the ability to detect the loading progress of all asset types and set state accordingly....

Overflow Behavior in CSS

I'm building an app for running tournament brackets which, by their nature are often large hard to break up so my app requires a decent amount of overflow handling. I am struggling to understand how to get overflow to work in many cases though, particularly when padding is involved. For instance here is a bit of my UI for adding players (see image) The parent clearly has padding on bottom, but the scroll refuses to take this into account. I've seen this change based on seemingly random things like the flex-direction. Is there a good guide or some rules that explains all this?...

Getting a type from Zod Schema

Is there a way that I can get a type from a Zod schema? Essentially I want to set the type the return value from a function to the type generated from the Zod schema.

store images on cockroachdb using prisma

how can a user upload images on database? what type should there be in the prisma model...

Is it possible to run websocket (trpc subscriptions) server in the same process as nextjs app?

Official TRPC example on using websockets with next (https://github.com/trpc/examples-next-prisma-websockets-starter) seem to run them separately, but it doesn't really look right to me, as i'm not ever planning to run my app on edge or serverless, and just want this stupid-simple monolith.

DES algorithm

Anyone knows how to write DES in Node? I have an assignment and my brain is melting. If anyone has a gist, it will save my miserable life. 🙏

I want only registered users to be allowed to login & only admin can register new users? (Next-Auth)

I don't want users to sign up themselves. I first need to check something manually, only then do i want to send them a sign-in link. I do know how to prevent anyone from logging in: ``` async signIn({ user, account, profile, email, credentials }) { const userExists = await prisma.user.findUnique({...