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

Passing async data to server components

hey guys. I have a basic question - I'm fetching some "slow" data in a server component (at the page level). There are several components on the page that depend on it, so I'm currently awaiting that data, but obviously it means I have to wait before I get anything. ...

I have been trying to get cache working with React-Query and Next.JS

Hello there, I'm trying to get this cache to work but I have searched far and wide and unless I'm blind or I didn't use the right keywords, I can't get this to work. Here is the sample code: ```ts const { data, isPending, isStale } = useQuery({...
Solution:
By default React query doesn’t use a persistent cache - so when you refresh you lose everything. Check out the docs here: https://tanstack.com/query/latest/docs/framework/react/plugins/persistQueryClient...

Anyone who knows CF Zero-Trust well?

I have a homelob running proxmox, i have exposed it through a Tunnel, i have it behind Access too, i want to be able to give access to all devices/users currently on the zero-trust network using the warp-client. it is possible? any workarounds for that, like, if not a warp-cli zero-trust-enrolled tries to access the protected url, they see the Access page, but when a device active on my organisations's network tries to access, they go straight to the app...
Solution:

Vercel server environment variables not pulling in

I am currently using using T3 Env for type safe environment variables however on vercel it seems that the server environment variables aren't pulling in for some reason. it builds fine in locally and builds fine using the Vercel CLI using vercel pull and vercel build. I have checked that my environment variables are correct in my settings and they are and are set for the right environments. This is the error I see: ```bash...

Shadcn Dialog + Form Error: React.Children.only

Hello, I'm want to use a From from shadcn inside a dialog from shadcn but I have this error : Error: React.Children.only expected to receive a single React element child. I don't really understand why it's the case I belive the error is caused by the <Form> ```tsx...

Most efficient monolith structure to have an Express.js REST API with Next.js SSR client?

https://stackoverflow.com/questions/78670127/most-efficient-monolith-starter-project-structure-to-have-an-express-js-rest-api Hi there! I'm starting a fulltack JS application, but would like to know your opinions on how an express.js server should be set for a Next.js frontend (Next.js API development is not an option for this purpose)....

View transitions aren't working with multiple elements with the same classname

Hey, I have quite a unique problem and I tried searching for the solution but view transitions are relatively new. I am using the next-view-transitions package. View transitions work how I expect them to when there is a singular element with the transition classname. But, I want to map through posts, and then when you click on that post, the title of the post transitions smoothly onto the next page. I have deduced the problem to the fact that if you have multiple elements with the same transition name, then it will not work. Im wondering if anyone has a solution to this problem. Possibly dynamic classnames, manually defining classes 1-10 and using pagination so they each have their "individual values", but all of those solutions seem very complex for something that may be so simple. Thanks! Non Working: ```ts {basePosts.map((post, _idx) => ...

create t3 app breaking next-theme?????

dudes and dudettes. im having a surreal issue with next theme. though if i initiated the whole app using t3 app it breaks while if i do so with normal create-next-app. i functions normally. there is really not much in the...

Turbo and prisma dont work together?

its weird that prisma does give errors such as cannot convert null to object on some stuff like creating a post or filtering by post cateogry while when i remove the --turbo flag from the dev command it doesnt. then i found ```ts...

json schema to yup raw version

I am trying to get the raw yup object with the chaining functions from a json schema. Tried some libraries but didn't know how to get the raw yup. ``` const schema = { title: "Person", description: "A person",...

Prefetching deeply nested loading.tsx doesn't work on NextJS 14

I have been banging my head around this for 3 days but i just don't understand why this is happening. Here's the issue: app/route-1/loading.tsx <--- This is prefetched when you open example.com/ app/route-2/nested/loading.tsx <--- This isn't prefetched when opening example.com/ app/route-3/(nested)/loading.tsx <--- This also isn't prefetched when opening example.com/...

ERROR! Invalid config: UnknownFileType

trying to use upload thing for my project. I am working with source 2 demo files. I used this mimetype checker, https://www.htmlstrip.com/mime-file-type-checker and it returns as application/octet-stream so i used that in the filerouter. However, when i try to upload anything, I just get UnkownFileType, and from the json request I can see that it is empty. They are large files, so checking the type might take some time, as the tool I linked did, but since it returns nothing, any way to manually...

Connecting to websockets in app router

I am looking to build an application that does the following: - connect to zoom - get users from zoom - subscribe to their status ...

Issue with Fetching PDF from Uploadthing in the server

I'm trying to fetch a PDF from Uploadthing in the server, but many time it fails. How can I fix this issue so it always fetches the PDF without problems? ```ts let response; let retries = 5;...

redirect on server action works depending on route ?

how come the first one doesnt work and throws an error, but the second one works fine?
No description

Multi-tenant in Next.js, How to delay the creation of the Drizzle client

I'm using t3 to bootstrap my project and integrating TRPC with Drizzle with app directly. In my multi-tenant application, the database connection URL is determined only after a successful login. However, creating a Drizzle client requires this URL upfront. Challenges 1. Delayed Drizzle Client Creation: I've postponed creating the Drizzle client until I have the connection URL. This step was straightforward. ...
No description

What tailwind class styles the color of the progress bar for the uploadbutton?

I figured out the bakground för the idle and redying state, but can't fint the command that styles the progressbar. that shows while upload. ut:button:ut:uploading is not the one apparently... className="ut-button:bg-black ut-button:ut-readying:bg-gray-700 ut-button:ut-uploading:bg-black text-sm font-bold"...

Migrate react-scripts to vite

I have a project using react-scripts 4 with a proxy-dev-server needed to start the app where I have: ```js const express = require('express') const app = express() const { createProxyMiddleware } = require('http-proxy-middleware')...

conditional rendering with url search params and server side data fetching with nextjs 14

I have a modal which is shown based on url params "?modal=friends", I would like to use as much server side data fetching as possible as it makes a nicer user experience, the modal should fetch the users friend list from supabase and then conditionally render either a dialog for desktop or a drawer for mobile (both shadcn components), ideally id like to avoid waterfalling components. so far I've tried. 1. parallel routes (completely broken and don't hot reload on changes, i had to completely restart the dev server to see changes) 2. doing client side data fetching which is slow and only fetches on render, i would like to fetch the data before the dialog / drawer is mounted...

Can't get human readable error messages on uploadthing.

The returned error doesn't come with a message that I could display to a client side user. Is this something we have to try to parse out on our own? or is there some way we can get this information. The docs don't seem to make this too clear or maybe I'm missing something. I found a really nice looking error message format in the uploadthing code but it doesn't seem like it returns this?...
No description