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

Problems with useQuery.onSuccess()

Hi there, I'm doing a query on my trpc router and when it succeds I want to put that data on a useState that expects a ReactElement based upon the data from the query. The data from the query response is an array with objects like {id: string, title: string}, when I get them I run a data.forEach() on the returning array but when I have more than one object on the array only one is displayed on the client. Here is a snippet of what I'm doing, perhaps someone can see what's wrong with my code...

do you have experience with the python prisma client?

hay gang, has anyone used the python client for prisma? what's your take? https://github.com/RobertCraigie/prisma-client-py ...

Conditionally required types

Someone that has any ideas on how I can make everything required if accepted is true, if it's false then the other 3 fields are not required. ```ts type GeoLocation = { accepted: boolean; accuracy?: number;...

Static typing key: value of an object while defining

Ideally, want to statically type the keys and values in THEMES object in compile time. Currently, keys are of type "string", which I don't want. `export type THEMES_CLASSES = | "light-yellow" | "dark"...

Require one of two properties

What would you folks say is a clean way to accomplish that either userToken or ConversationId are set in my type without requiring both? 🤔 ```ts export type PostChatData = {...

Zod array of dates

Can someone help me validate that a variable is an array of exactly two dates and ideally in the future. Here is what I've currently got. However it allows an array of two nulls which isn't what I want....

Posting PDF to S3

Hello, I Hope this is the right section for Question, it feels like it is. I am working on an Project, part of it is an REST Api and different front ends (admin page, employee page, customer page ). We are using aws s3 to save relevant files, like customer bills, employees qualifications, etc. Primarily PDF (if not only). ...

Hello

I am getting TypeError: Cannot read properties of null (reading 'useContext') When trying to getServerSideProps in next export const getServerSideProps = () => {...

Hello everyone, I need help, I stuck at rendering a component insider a div. My code is like below,

const labelItem = Array.from(document.querySelectorAll('label')) .find(el => el.textContent === 'External Org Name'); const parentDiv = labelItem?.parentNode?.parentNode?.parentNode; return(...

Moving a repo inside a repo!

Hi guys, I have two projects that i want to merge: 1. A nodejs scraper 2. A Next project ...

Next Image Behavior

Hi, I am just curious if this looks like normal nextjs image behavior (the popping in of the images)? https://rust-meta.vercel.app/raiding/calculator Thanks!!...

resources suggests

Am looking to trigger events, read and write to database etc all from task and queues I have zero knowledge on this looking to do a few things with it like payments processing and image optimization Suggestions that works best with express js ...

Using outer and inner context together [trpc]

Hi guys, I am experiencing troubles during implementing both - inner and outer context in one appRouter. Let me show you an example below: I want to use two contexts alternately, when I'm calling some stuff on client-side I want to use outer context, but I also want to use getServerSideProps to send some other queries, that are context unrelated - here I want to use inner context. Is there a way to combine both contexts on createNextApiHandler (appRouter), or I need to create two 'apis' - one for inner context and the other one for outer context?...

Next Build Stops After Type Validations

I have a dokku deployment set up which when running, no longer successfully builds my app. The logs outputted are the following: ``` -----> Build Running build (yarn) yarn run v1.22.19...

Image upload for MongoDB?

Hey all, I currently have a MongoDB which I store recipes, users and user sessions, I am implementing a recipe image that the user can upload on creation (or after), it doesn't seem like mongodb is good for images, what would anyone recommend for implementing a recipe image upload?

Need help with picking the right tools for a project

Hi there, I need to implement a new project based around currently existing solutions in my company. I want to implement t3-app as a form of dashboard between environments. Tldr I have prepared a short description in the form of an image. I would like to talk about all sorts of possibilities, suggestions for a solution welcome, if anyone has already encountered something like this....

Protected routing premium user

I want to implement protected routes where a user needs to have a "premium" account to access it. How can i do this? I have implemented normal protected routes using getServerSideProps already...

SOLVED | NextAuth build error | CLIENT_FETCH_ERROR

I have a t3 app which works fine when running it via npm run dev. However it does not work when i run it via npm run start. I just get this information shown on the website whenever i try to access the log in page. Any thought?...

t3 app doesn't work offline

In the older versions before this renaming and from trpc. To api. I could work offline (turning off my wifi connection) using my local database on my machine But of recent i have observed that the whole app doesn't read or write when they is no network connection But once i connect to the internet it automatically loads everything and gets in sync with all the queries etc made offline...

register limited people

hey, im working on a project that only allow few invited people to register and then use my website. is there a way to do that? thanks in advance...