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 Refetching on page change

let { data: orders, isLoading, isFetching, isError, error, refetch } = trpc.order.getallcart.useQuery(undefined, { retry: 1 });
let { data: orders, isLoading, isFetching, isError, error, refetch } = trpc.order.getallcart.useQuery(undefined, { retry: 1 });
I am using this code ( react query + trpc) , i want whenever i change links , router , the query should rerun and new data should come from the database but it is not happening , i tried various refetching methods but none of them worked , anyone who can suggest something...

expo hermes flags

I want to launch hermes with -Xmicrotask-queue to enable weakref support, but I couldn't find anything in the docs

React-hook-form fields based on API call.

I hit an API to get fields for a product. The field properties usually get defined before with Zod. The problem is if the API got changed it won't be in sync. Example of the res data: ```json { "id": 766,...

Handling tRPC or React Query errors on the client side.

Hey everyone, I wanted to get prespective on how would you handle errors on the client side side when you're doing a query or mutation. Let's say, it's a login form and the user somehow bypassed the built in input validation in HTML and browsers. How do I handle the error that has been thrown by zod on the server side and do some effect on the client side....

setting eslint to make absolute imports work

I would like absolute imports with @ to work in my project but when I set it to work imports like: import { z } from "zod"; stopped working. There us eslintrc code: ```{ "extends": [ "next/core-web-vitals",...

Why Prisma does not set the proper type for related field?

So I've been banging my head against this issue lately and it seems to me that the only way around is to create a separated ZodSchema to solve it. Thing is that in my PostgreSQL database I have an optional relation but when I query with that relation the type that I get back is still optional, even though I pass that to the query in order to get the rows 🤔 Here's for example, in my Transaction table the hodlId field is optional. But I am just passing it, so how it could be optional if that's the base of my query?...

Next app dir loading page twice

Hey all, I've noticed strange behavior when doing a hard reload (or loading for the first time) a page in Next's app dir. The content of the page first loads nearly immediately, but then after a moment it gets blown away and then loads in again, almost as if the entire page is being unmounted and mounted again. I've attached a video showing what I mean. Anyone come across this before or have an idea on what it could be?...

Discord not signing in

I'm testing create-t3-app. When I click sign in I get a 302 status code.
No description

Jr DEV new to T3 Stack. ERROR

"You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) to ensure you have the correct code for your production build." I am not sure how to solve this. Any Suggestions?

Implementing login with Prisma

Below is the source code of my api but I figure out that any one entering credentials when an entered email resemble that of the one in the database, the user is authenticated without checking the corresponding password, how can I fix this, as the stored password is hashed? ```ts import { NextResponse,type NextRequest } from "next/server"; import prisma from "@/prisma/client"; import {Redis} from "@upstash/redis" ...

hello guys, so It's a bad idea to use Prisma in Vercel because of the 500ms response?

I've watched Theo's video and It seems like continuing to use t3 w/prisma in Vercel serverless is not a great idea because It's very slow to fetch data from serverless.. so should i switch to the drizzle or keep using prisma and tolerating the slow response? thanks for you guys' help....

When to use a server component vs a client component in NextJs?

When to use a server component vs a client component in NextJs?

messenger bot api

im trying to make a messenger chat bot for a group chat and i found this unoff api on github but im not sure if it can have a negative effect on my gc especially causing security vurlnablities or causing to close all the users acc's https://github.com/Schmavery/facebook-chat-api

Best cloud provider / stack solution for this

I want a few non-relational databases and then some kind of elastic search (yes that is the AWS one but I'm also looking at GCP, but that doesn't seem to be open for individuals as much) for caching and serving. The databases would be accessed from two springboot (I'm open to Go or other tech stacks for writing REST APIs) which would also be hosted so like I could have a public API open to the internet to read one database. Another service would be only accessible for authenticated users to read a database that is able to be POSTED to by a public API but only read by the authenticated users, there should also be some edge function on the write side to filter the entries coming in. Then there needs to be some other edge function that when triggered it transfers a row record from the (pub write / priv read) to the (priv write / pub read) database. I can create a tech stack diagram of what would be needed but I'm not exactly sure on the provider / tech. I work in software engineering and have done cloud dev but that's for enteprise not for a project that's going to start out as an individual. I know there's like DynamoDB (database) / Elastic Search (SaaS) on AWS and like BigTable / DataStore / FireStore on GCP and I can host SpringBoot on GCP but I'm not sure of the specifics, like do I host my data on AWS and the APIs on GCP, any help from experienced cloud devs would be amazing....

UploadThing question

Hello, I'm planning to add UploadThing to my project and I want to know, is it really required to use TypeScript? or I can use it in regular jsx/js?...

How does next13's /app routing api integrate Jest testing?

The api routing style I use is export async function POST(), but it is not like an endpoint in /page, which makes it difficult for me to simulate this service as usual

Vercel Caching Data during Deployment

Anybody hosted a website in Vercel recently, as when a data is fetched during deployment, it caches it even if the data is changed, so everytime a data is changed I need to click redeploy again, how can I fix this? Tried ``` export const revalidate = 0;...

How to stop a div using 100% height from growing within a flex container

I have a flex container with two divs, one has a fixed height and the other one has 100% height (h-full). I need it so that the div with full height becomes scrollable if it overflows instead of growing but for some reason it always grows to a limit (which for some reason seems like 100vh, 🤷‍♂️). I need it so that it doesn't extend beyond it's initial height if it doesn't overflow.

Looking for code review on trpc method calls

As stated I'm looking for some code review on a blog that I've been working on using the T3 stack. I'm relatively new to web dev and am working on the app for personal use and have it working but I also know that I have made some programming fauxpas and more or less looking for "you are on the right track here" or "yeah... stop what you're doing here and refactor, try..." I don't know exactly if this is the correct channel to ask this sort of thing in.
Full repo here: https://github.com/L-Steinmacher/next-blog I know that the logic on this component needs some love badly with the trpc calls:https://github.com/L-Steinmacher/next-blog/blob/25c33410f19b4e0be4b6fb58122949b0d5c3026f/src/components/commentLayout.tsx#L52...