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

displaying sensitive card data (card number, CVV2 and PIN) to a customer

I am trying to display card details to users but the documentation of service am getting the cards from,they suggested VGS Show JavaScript library But this library is very complicated and hard to use Am I just want to displaying it plain in div etc ...

Delete PlanetScale Organization

Hey guys, I was just messing around with the PlanetScale dashboard and made a new organization as a test. I thought it would be easy enough to remove the organization after creating it, but I don't see any obvious way to do that besides deleting your whole account. Apologies if there's a simple way to do this, I just wasn't able to find it myself or online. Thanks :)

Cleaning up setter function that is a function

So I need to set my state to this: () => {}. However, if you supply () => {} to react in a setter, like so: setState(() => {}) it will instead return an empty object, since React uses that syntax to use the previous state. Is there a better way to do this than this: setState(() => () => {})?...

Tailwind component I copy and pasted is buggin

The code I copy and pasted is attached. The component is supposed to look like the first, but looks like the second instead:

React Query, How to perform infiniteScrolling with custom variables

I'm using useInfiniteQuery, I basically want to load as you scroll down, but I also want to load data as you select on different filters. The way I implement it in Desktop View is using number pagination with useQuery is as follows useQuery(["key", page, showSelectedOptions]) ...

Tailwind smooth scroll

Hello, It is probably super simple but I have a simple react app in vite, the app.tsx looks like this ...

Get tRPC Connection Status

Is there a way I can get the current connection status without having to create a specific query that regularly pings?

SCSS Error: can not read files in public path

I have an assets folder that contain some other files with images and svgs in it in the public file of my project so... => navbar.scss ...I declared a variable with path below
$logo-path: "/assets/logos/black.svg”;
$logo-path: "/assets/logos/black.svg”;
Error: Module not found: Error: Can't resolve '../../../logos/mobile.jpg’...

Handling undefined errors on TRPC dependent queries

Really loving TRPC and relying more and more on the Tanstack to learn a bit more. In my app, largely a very simple modification of the base from TRPC, I would like to fetch some data and pass this to a second dependent query. I believe this is achieved as follows: const { data: product } = api.product.getUnique.useQuery({ id: pid });...

Best Approach for error handling

Hi guys, what is the right approach for error handling, would really appreciate if someone can help me think this through 1. Using Context api to manage error state globally 2. Managing error locally at component level...

How to automatically call 'prisma push'?

Hello, I just tried to deploy my first t3 app on vercel+railway, however everytime I called a route, which accesses the database I got the error: 'The table prisma.XYZ does not exist in the current database'. After reading up a bit, I realized, I needed to run 'npx prisma db push' first, to seed the database. Since this command doesn't seem to be run automatically, with the default config, and I obviously use a different db, when developing locally, when compared to actually publishing the code, I'm wondering how you people handle this problem of having to push the db schema first. Is there some established pattern?...

nextjs api handler issues error about not sending a response when response sent. wai?

for this code: ``` export default function handler(req: NextApiRequest, res: NextApiResponse) { // return promptController.specific(req, res); fs.readFile('json/foo.json', 'utf-8', (err, data) => {...

SPA state in Zustand store being preserved across page navigation?

I have a form which gives users the ability to submit payments via either credit card or PayPal. When a user selects PayPal, the form is toggled into a loading state with overlay, and the user is redirected to a PayPal sandbox URL. To my understanding, this should mean the app unloads and all state would be reset fresh with another load. However, I'm observing that when using Incognito mode (not sure why it's only consistent that way), hitting the "back" button from that PayPal location will bring the user back to the form, with state still preserved. The overlay is active, all form data is saved, etc. Do browsers preserve such state for recent pages? Is there a way I can consistently ensure this doesn't happen? If a user hits "back" I'd ideally like to simply trigger a location.reload() for simplicity....

`Cant install mongodb on mac`

Cant install mongodb on mac I cant install Mongodb on my mac keeps failing with the error below...

Not being able to render my React app

I don't why but I felt like trying to setup a minimal React setup using Babel. I created the HTML and added both the script tag to load the output from babel and the div with id root to be used as the entrypoint for React. However, things aren't working somehow 🫠 The JS is being loaded by the browser but nothing is rendered somehow. It seems like I missed something simple that I'm not being able to spot. Can someone help me finding it, please? praydge Here is the repo: https://github.com/ubmit/barebones-react-experiment...

What are you using for authorization?

Hey, so I got started on the "full" T3 stack recently and I'm wondering what everyone here is using for authorization?

Responsive large tables?

What would you suggest for having a large table (100s of rows) with lots of columns (10-15) for displaying in a mobile view? What have you tried before with good results?...

Next Build Works Locally, But Not on Server

Running yarn build (i.e. next build) locally successfully creates the optimised build, with the following output: ``` info - Linting and checking validity of types... info - Creating an optimized production build... ...

Is there a way to create "const objects" from zod?

Im looking to create an object of default values, and an object of literals to use as an enum: ``` export const homeAddressFormSchema = z.object({ clientHomeAddressLine1: z.string().min(1).optional(),...