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

TimeZone issue

'TZ' is not recognized as an internal or external command I am on windows is there a way I can fix this?...

can u make twitch clone with t3 stack

im just curious if this is possible or not and would the performance be acceptable? not asking how to do that...

Prisma & CockroachDB - push to array

next 12, prisma 4.7.1, CockroachDB When I try to push an item to an array field, I get an error: "Did you mean set?": ``` await prisma.character.update({...

Weird State Performance Issue

Hello, I am working on a project right now where I have a list of components that are based off of a zustand state object. Each of these components in the list is assigned to a specific <key, value> in the zustand state object, and state is updated whenever one of the form items is changed. I am running into a performance issue with this however, since every time a form value changes it re-renders the entire list of components. Most of the changes I am making to the state however, do update the file object but not the values from the object that actually get rendered (the component updates more metadata-esque items). I have attached a diagram that I think might help explain this a little better. Does anyone have any recommendations on how to make this more performant? Thanks in advance for the help!...

How bad is revealing ids really?

Hey, I am currently not using DTOs or sth similar. And I was wondering how bad it really is if i expose my primary keys of a table in my frontend by giving over the whole object returned by the prisma client. I know it's bad practice and seen as a security breach ... but I never fully understood why. If I send a DTO with the same values but some uuid instead of the id (primary key) i still have to persist the uuid in the table and although it is not the primary key ... it is still an identifier that i have to use and a "hacker" could use too....

how to delete post if it has likes

Hello lets say I have a post that i want the user to be able to delete, however the post also can have likes. If I use something like this: ``` delete: protectedProcedure .input(z.object({ postId: z.string(), }))...

Recommended pattern for consolidating data in tRPC?

Hey all, is there a recommended pattern for consolidating data so that the format of the data in the output is consistent? Currently building a standard t3 app and am considering using either links or a context dedicated to formatting the output of the data...

Tailwind Default Colors not showing automatically

When I use something like bg-gray-800 it's not showing up. If I go and add it explicitly in my tailwind.config.js, it works. But they're all suppose to show up by default, correct? Did I configure tailwind incorrectly when I used T3? ``` const colors = require('tailwindcss/colors') /** @type {import('tailwindcss').Config} */...

React Select - Unselect and remove placeholder when clearing input

Hello, When I select something and then delete the input, it still shows the chosen option in the placeholder and does not remove the chosen option. I want to unchoose the chosen option when the input changes and not show the chosen option in the placeholder when input is empty....

Scss in Next without modules?

Surprisingly difficult to find an answer for this when i was googling. Here's the situation as ive been taught in previous jobs: Say i have a component <MyComponent /> and i expect some default styles for this, defined in a mycomponent.scss file like: `.MyComponent {...

Promise-returning function provided to attribute where a void return was expected.

On line 18 of https://pastebin.com/9EXv58Bn I am getting the error shown in the title. Should I just disable this eslint error with // eslint-disable-next-line @typescript-eslint/no-misused-promises as suggested in the "Quick Fix" ? Or update the default .eslintrc.json provided by create-t3-app?

HeadlessUI & Astro

Is it possible to use the react tailwind ui components (based on headless ui) in an astro project or i should stick with the default js + html template for the components. Really want to try out astro as an SSG but most of the code we currently have is in React.

Python app + nextjs frontend writing to the same database

I have a python app (discord bot) that keeps track of settings/stats in a postgres database. I want to build a dashboard with the t3 stack where you can view and change those settings, but I'm worried about schema clashing with prisma. I currently use asyncpg and no ORM in my python app and plan to use prisma on my frontend. I'm early enough in development where it wouldn't be an issue to switch to prisma in my python app, but that might create more issues like schema sharing. Also, is possible to create a monorepo with a nextjs app and a python app? I couldn't find anything answers online....

Is there a String Union Type of all HTML Element names?

Pretty much what the title says. I want to be able to pass in any name of an html element, to then apply a style to, and return to the user.

How to make tRPC calls from the server side

I have tried following https://trpc.io/docs/server-side-calls however I get the error shown in screenshot Is it possible to call one tRPC method, from another on the server side?...

Need help to approach Layout issue

So i've got a Layout wrapper component for my (almost fully) static app - Problem is, this Layout requires certain Static Data, product categories. The way I do it now is every page calls my <Layout categories={categories}/> component with the categories props which are statically fetched on every page's getStaticProps - Is there a good way for me to be able to wrap this Layout component across all pages in _app while still having access to the categories data?...

How does one handle a lot of conditional rendering based on the permissions of the logged in user?

It kind of seems annoying to have check(user.permissions, Permissions.MANAGE_OTHER_USERS) for everything, especially when different permissions activate different UI elements.

How would you securely call a protected tRPC route from a webhook?

I want to call a protectedProcedure from a webhook, but how could you do that without a user/session? What could I pass to ensure the call is coming from my webhook?

Any suggestions for good resources to learn about refactoring react applications

That can help us understand the industry standard tips and tricks, that will allow us to build large applications in react.