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
Ffero.xd5/3/2024

Weird react behaviour

I am rendering a element for every item inside of Root's children array, in that element i have a state to open or close the item (if its a dir). When someone opens a directory , i render a Nested Component that uses react query to fetch the contents of that directory and render them, and the nested component again renders the item (recursion goes on). This works fine in itself but when i have a zustand store that stores the current file and directory opened, the tree behaves in a very weird way.. the folders wont open even after multiple clicks and will randomly open on another click. It seems like updating states is fine but when the component is re rendering coz of the state change, then its causing issues https://pastebin.com/eJvbiirr...
SWSycamore Willow5/3/2024

Using Multiple DBs with Drizzle

Hey all, I'm using T3 for a proof of concept at the startup I work at. I'm really really digging this stack and want to pitch it to our team to replace our current stack. I've chosen to work with Drizzle, can explain more why if necessary but will wave my hands at that for a moment. One key thing I need to demonstrate in the POC is that I can run queries on multiple DBs that live on different hosts. I did not think I'd get stuck on this bit! But I'm stumped. Here's what I've done:...
Bberoer5/3/2024

React Portal renders the element passed as children 2 times

Any idea how to get around this? Idea to troubleshoot? I tried reproducing it on stackblitz, using the same state management library I'm using in the project (zustand) and I wasn't able to. There it renders once, as expected. Came across this while learning E2E testing. Here's my Portal:...
No description
CCPG5/3/2024

Best fully typesafe, fully managed, headless CMS with a generous free tier for Next.js 14.

Hi, what headless CMSes do you like/recommend the most? I recently tried Sanity and did not like it that much as it lacks typesafety so I tried using @sanity-typed with it which improved the DX a whole lot and added typesafety, but it turns out that the Sanity studio does not play very nicely with @sanity-typed. I am looking for a headless CMS, which is fully typesafe, has a premade dashboard to manage content and has a generous free tier. Santiy checked nearly all of these boxes but the lack of...
Rrocawear5/3/2024

React Query hilight new data after mutation

Hello, after i mutate, how i display new data on my table with green background? I've tried to look into queryClient but not sure from where to get the new data. For example there is getMutationCache() but cant make it work. Any help is welcome!
PPixelPioneer5/3/2024

Hosting platform

Hi, I do you guys know a hosting platform that supports exposing multiple ports to the public , if it has a free tier it will be great as I want to try my idea out first
background on why am i doing this -> I have a dockerized next js app that also has golang api ( go cause i want to run next in dev mode in prod and golang to make react components(by llm) by using create dir. by using file based routing on the fly ) as next js gives error if the react component is wrong and will not let api work...
Mmchisolm05/2/2024

Global error when clicking on photo in Gallery Tutorial

Following the new create-t3-app tutorial for a gallery app and locally everything seems to be working (click on image, get modal. Refresh page, get only image). In production, when I click the image, I get the global error page 500. Is that because of this change I made to get the <TopNav /> to render with and without being signed in? ``` <TopNav /> <SignedIn> {children}...
Ggave_one5/2/2024

Not able to sign in with credentials

The first screenshot is the terminal log of the event that happened. In the screenshot, I found a user, and then I did some basic validation stuff to sign them in. The second screenshot is the credential logic for logging in.  The third screenshot is a server action that validates the credential if the user exists and if the password matches, shows a different error message. If there is no error message, sign them in....
No description
TTraconis5/2/2024

github auth

I replaced default Discord's auth with Github auth, however both method in the end produce the same error hence it must be something weird on my end 😦 I checked auth, .env, env.js but still getting the below AFTER SUCCESSFUL AUTHORISATION with a chosen provider. I mean the corresponding widget is displayed, user authenticates themslevels and then the server return the below error and the app displays attached error message. `[next-auth][error][adapter_error_getUserByAccount]...
No description
Tterlan88925/2/2024

how to show cached data initially but fetch in the background and replace the stale data as on RQ?

In React Query, we used to have the feature that when user navigates to route, they will see the previously cached data for that route while RQ is fetching new data for that route and swapping it on the ui. How can I have the same behavior properly implemented with Next.js 14 app router? Thanks
MMonster5/2/2024

Scheduled Notifications

Any ideas on how I could do scheduled push notifications for my web app? I'm working on a calendar app, and the one thing I'm unsure how to do is the notifications. Ideally I want it to be a PWA as well, so you could "install" it to your phone and get notifications there.
Ddeforestor5/2/2024

TRPC error handling (on client) is confusing

I'm not quite sure whether I'm doing this wrong or this is just how it's supposed to be, and I don't like it. ```typescript const onSubmit = async (data: FormData) => { createThing.mutateAsync( {...
No description
AAguilar5/2/2024

Developer tools for Arc on Windows

Anyone using arc on windows? curious if the developer tools worked out for yall. My friend couldn't toggle the device toolbar
FFagner5/2/2024

UploadThing in a backend application

I'm trying to use uploadthing in my Discord Bot, since I don't have any routing or anything complex, I thought that using UTAPI SDK would be enough, but I'm facing a weird error. Whenever I try to use any method provided by UTApi errors with (FiberFailure) TypeError: Attempted to assign to readonly property. Full Error: ```...
DDawson5/1/2024

t3 second drizzle client

Hey all, anyone know why apiDb shows up as not working? Originally when I had keys schema imported under apiDb, it worked perfectly fine. db and its table works fine. index.ts: https://paste.learnspigot.com/dicuhehiri.typescript api-schema.ts: https://paste.learnspigot.com/guqayuviwe.php schema.ts: https://paste.learnspigot.com/enufuvujuq.php...
LLukem1215/1/2024

t3 stack app router examples?

I have been working on a new project and using some basic forms. However, I am having difficulty working with server components, tRPC, and React Hook Form using ShadCN. I am looking for some simple codebases that I can learn from. It would be great if they are not too complex and still up to date....
FFabien5/1/2024

Next.js on Plesk

Hi, I have been scratching my head around for a few days not understanding an error message from the plesk server I tend to host my app on. I've tested this host in the past with a bare create-next-app it worked flawlessly, I tried the T3 stack because why not, worked god at home (win/debian) but on the production server ... An then it hit me, it talked about beeing a "module", then I searched why and landed on this comment in the commit that led to it : "imo every project in 2023 should use type: module" So the 2 questions are :...
Solution:
// entry.cjs async function loadApp() { const { app } = await import("./app.js"); // this is your normal entry file - (index.js, main.js, app.mjs etc.) } loadApp()...
Ppsygo5/1/2024

Converting String Encoded Images to Files to upload with UploadThing

In my app, I'm using a libary which handles files in a file manager as base 64 strings. Is there a practical way of uploading string encoded images with UT? If not, here's what I've been trying (the rest of the code is basically the docs' default setup): ```ts const url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII="...
Yyktv45/1/2024

next-auth v5

I am starting 2 new proejcts that will last for a while. Currently create-t3-app uses next-auth v4. Given the proximity of the next-auth v5 release, I was wondering if there is already a support for next-auth v5 out of the box? I know I can do a clean install and follow the upgrade manual myself, but hoped there is a branch somewhere that I can use to have a v5 working out of the box. Thanks!
IItsAMeMarios5/1/2024

discount coupon

I got a discount coupon 2 years ago I didn’t use. Now a friend of mine is interested in starting the course and needs lower prices as he’s short on money. Any ideas? Thanks
Next