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

535 Authentication failed 'Bad username password'

I'm setting up NextAuth with SendGrid, and when I click the link to send the auth email I get a 535 Authentication failed: Bad username / password error. I just tested it in a terminal and my sendgrid credentials are accurate and working. Any suggestions on how to debug?...

Is Capacitor + T3-Stack possible?

Hey, so im building the scheduler app for personal usage and I'd love to use Capacitor to run it on mobile (coz i kinda don't want to use ReactNative). SOOO, is it possible to build "Next" app into what Capacitor is building apps (I feel like serverside-ness of Next is what will make my life a nightmare at this project)? What are your suggestions for building this project if not with Capacitor? Thanks ❤️

Next.js dynamic route param typesafety

Is there a better solution than this? Feels annoying to do this for every dynamic route. ```ts // [userId].tsx ...

react query question

currently when fetching the current user im checking if the JWT has expired, and making a call to a route to refresh the JWT. I placed both of these in 1 query (which I think is bad practice), how can I split them up? ``` function useAuth() { return useQuery( ['user'],...

TRPC multiple mutation procedure

I have currently a formular which calls my mutation. The query should create multiple different entities, currently I am doing that this way, is this way good or is there anything would I can refactor here? ```ts import { createClientSchema } from '@/lib/zod/client-schema'; import { z } from "zod"; import { t } from "../trpc";...

Load theme from cookies without fouc

I want to load my theme from cookiees without a flash of unstyled content (nextjs), is it wise to use a synchronous script tag for this?

tRPC Subscription WebSockets can't subscribe

TRPCClientError: Unexpected request method PATCH
TRPCClientError: Unexpected request method PATCH
...

[solved] Running into build error with import even when it works locally.

Have a file Layout.tsx importing Header.tsx both in same directory, but still runs into build error.

does anyone know how i can serve a subdirectory in vercel?

[solved] serving a repo that has a /app folder inside which contains the next app, want to serve that and not the root directory.

is there a way stop vite client from re-connecting to the server?

the client keeps logging GET http://127.0.0.1:3000/ net::ERR_CONNECTION_REFUSED they have nothing on their site. should I just modify client.ts?...

Help me write a cleaner method?

Hi all, I'm writing a function to break a list of assets into chunks with a max size. I have an array of objects with the following signature: {url: string, size: number}. I want to end up with the following: ...

Functions type for key of objects with specific key

Hey, are there any typescript wizards here that could help? I've been trying for a while already but don't really get there. I would like to type a function that takes in two arguments: an arbitrary object as the first argument and for the second argument a key of that object but only allow keys with e.g. a number as an associated value. What's the best way to do this? This is what I have so far. I only want to allow valueKeys which have a type number as a value. Thanks! ```ts const BarChart = <...

How to figure out how long a postgres sql query will take

Sorry for the vague q, but I find myself having to write alot of custom sql queries these days to make zapier "be our backend". Zapier will fail the zap if a query times out. But I dont know a good way to gauge at what scale we will reach 30 seconds. Here is a query in question:
SELECT "proposalId", string_agg("ProposalDateRanges"."from" || ',' || "ProposalDateRanges"."to", ';') FROM "public"."ProposalDateRanges" WHERE "ProposalDateRanges"."proposalId" = '{{169303871__id}}' GROUP by "ProposalDateRanges"."proposalId"
SELECT "proposalId", string_agg("ProposalDateRanges"."from" || ',' || "ProposalDateRanges"."to", ';') FROM "public"."ProposalDateRanges" WHERE "ProposalDateRanges"."proposalId" = '{{169303871__id}}' GROUP by "ProposalDateRanges"."proposalId"
...

Should I start with what I know, or what I don't?

I'm building an app with t3. If I can complete it, I intend to release it to the world to use. I've done a lot of frontend, some backend stuff. But when it comes to "putting it all together" I find myself a bit stumped on where to start. Part of me wants to just build out the feature/UI stuff without any really API/backend things happening. Another part of me knows that I'm avoiding doing those things because I'm unfamiliar with them and thus they are terrifying. ...

Prisma type safety

You guys have any idea what's happening here and why it's not working? https://www.prisma.io/docs/concepts/components/prisma-client/advanced-type-safety...

Order results by a nested relation's DateTime with Prisma

I have a Conversation model which has one-to-many relationship with Messages. I want to order the conversations by the most recent message, but it seems Prisma doesn't have a way to do this??? I need pagination so I can't do this after querying either, so is my only solution to write the SQL myself? I get the love for Prisma, but there are so many things missing 🙃

Prisma - Timed out fetching a new connection from the connection pool

Hi there, Sometimes, even with a very small site (nextjs, hosted on vercel), I ran into this issue: PrismaClientKnownRequestError: Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 5) Unfortunately I dont understand the suggested connection pool tuning. Any specific recommendations regarding Vercel Hosting?...

can I remove prisma and trpc from T3 app if I want to?

Hey guys so I'm buulding something with T3 , and I'm wondering if I will need prisma and trpc in this project. If not - can I just remove it? And how?

Alternative to TypeScript Classes

Currently, I'm refactoring TypeScript code into classes because I want to use extends for N features to inherit some base functionality. Previously, I had pockets of functions organized in separate files based on the type of functionality that they were providing. (foo.ts, bar.ts, baz.ts) I figured classes would be better to stay DRY, as it removes a lot of copy-paste boilerplate between every feature. (common variables + common functions) But I'm finding it really difficult to transition this structure into classes, because there are shared variables in a feature directory (variables.ts), and there is no partial keyword in TypeScript like there is in C#, so I have to stick thousands of lines of code in the same file (to avoid circular imports). ...