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

Does anyone have a good way to avoid opting out of caching when reading headers/cookies?

Hopefully this isn't a super noob question, but I've done some research, and I don't think it's a trivial problem. If you have an app that uses cookies/headers to render something SSR with NextJS using the app router, is there any way to get NextJS to not opt out that route from setting the Cache-Control response header to something that allows caching? From what I understand, if you use a dynamic function within a route, Next will opt you out of caching and there's no way to tell it that you can cache responses using one of those headers/cookies as part of the cache key, knowing that your response is unique to that value....

setting state param in nextauth

Does anyone know how to set the state query key to oauth providers instead of having nextauth set it automatically? I'm using Auth0 so I need my custom state value sent to the /authorize endpoint and returned back to my callback

Add trpc to app. How bundlesize is affected

What should be the increase in the bundlesize if a add trpc in my app ?

Await server onUploadComplete hook on the client.

Is there a way or a recommended pattern to run some side effect in the onUploadComplete hook in UT router and only once it's done resolve startUpload promise on the client? In my app a user can leave a review with an image attached - first client sends a request with review data and it gets saved to the database, once that resolves client starts an image upload and in the onUploadComplete hook on the server I update the db review row with a newly created file key. Problem is - I would like to refetch review data on the client to sync it with the server once data is successfully updated. But there doesn't seem to be a mechanism to await until onUploadComplete resolves and so what I got is a race condition if a client's sync request will be after(good) or before(bad) hook updates my db with new file key. Code more or less looks like this. ```...

how can i declare *.d.ts modules in assets/js/ folder and and import them as modules in my component

how can i declare *.d.ts modules in assets/js/ folder and and import them as modules in my component controllers in Angular

need a good redis hosting service

Need a good Redis service: No credit card required. No trial. No phone number required. With persistence. Free or cheap service which takes payment in crypto. Minimum 10 MB persistence. Uptime 24/7. Minimum 100 MB RAM.

Importing npm packages in Deno

Hello everyone, I am trying to create a Supabase Edge Function which uses Deno runtime. I want to import the Clerk SDK from NPM but I am running into a Not found error....

tRPC useQuery() or useMutation()

I have a component with a form containing a question about a secret name. When submitting that form I want to validate that the user sent the correct secret name. What should I use? (the name will be in my environment variables) Im currently trying to implement it with useMutation(). Is this the correct method to use?...

uploadthing: attaching metadata not working

I'm uploading images using uploadthing.uploadFilesFromUrl but I don't see them stored anywhere. This is how I'm using the function, it's a very simple code.
await utapi.uploadFilesFromUrl(imagePath, { foo: 'bar' });
await utapi.uploadFilesFromUrl(imagePath, { foo: 'bar' });
Any idea how to browse the metatags on uploadthing dashboard or when retrieving the files?...

Lint MDX files in Astro project

Does anyone has an example of how to configure ESLint for MDX files in an Astro project? It's driving me crazy when I add React components in a MDX file. Also, in VS Code, the TS syntax part is not highlighted, despite having the MDX extension installed. 🤔...

TRPC's useContext does not invalidate query.

Still dont know why useContext is not working for me (using .refetch, .invalidate on utils does nothing): I can confirm that onSuccess gets called. It also doesnt work even if I remove the enabled option. It invalidates when I put an override on createTRPCNext but I really don't want to invalidate all the queries in the cache. ```ts const utils = trpc.useContext();...
No description

Implementing Middleware

Hi guys been implementing Middleware to protect admin and user page but to some points I failed to protect two pages /adupload for admin to access and /home for only user to access. Below is the link to how I implemented it https://github.com/Revaycolizer/next-learn14/blob/main/middleware.ts...

discord callback url

I deployed my project to verscel but my discord redirect url for nextauth isn't working. The verscel domain is :https://forex-news-discord-bot.vercel.app/ so I made the redirect url https://localhost:3000/forex-news-discord-bot.vercel.app/...
No description

CMS based i18n

Is there a good CMS anywhere that would allow non-technical folks to create + publish articles, but ALSO manage all the regular app copy and buttons? This will be integrated into a Next.js app...

Drizzle with T3 and NextAuth

How difficult is it to use drizzle with NextAuth in T3? I started down the path and ran into all kinds of issues. I eventually worked out all my issues so far but I am concerned at what else I will face in the near future. Looking for suggestions? Should I just continue using drizzle with T3 or wait until it is an option as an ORM in the T3 install (and use Prisma)?...

Using pusher with T3

Is there a guide on how to setup pusher with T3 correctly with context? I know that theres zapdos but it uses deprecated stuff from zustand, is there any newer solution?

Problem with my express toy app

Hi there people. I'm trying to find out why when I try to access a page after sending a form , the given page won't load any stylesheets. When I access the route directly it works normally I have found that when I comment the writeDB() call in the controller, everything solves itself. ...
Solution:
when you save the new user to the json file

Guide to extending t3 template?

Howdy! I love t3 and have been using it for months here at my job. The thing I was wondering about is if there is any information on extending the t3-starter template on my own fork. I would basically like to make a custom version of t3 with some different defaults / packages installed on my fork. But I genuinely have no idea how t3 was made / where to get started. Has anyone documented their journey doing a similar thing?...

Some of the conditions are omitted in middleware

some of conditions are not checked by the middleware as when a user is authenticated and navigates to /register he should be redirected back to /home but it does not do that only /login condition works but others do not work using codes below ```ts import { verify } from 'jsonwebtoken'; import { NextResponse } from 'next/server' import type { NextRequest } from 'next/server'...

tailwind error?

Hey I have a weird... Bug? i think. It looks like hidden class has presedence over the md:flex? https://gyazo.com/715ab2f6df0172b4c3bbf730e83e8aa6...