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

ssg doesn't work for new data

When a user creates a new post, it doesn't generate a new site. I thought I could achieve that through revalidate but it doesn't seem to work. This is the code of post/[id].tsx: ```jsx export const getStaticPaths: GetStaticPaths = async () => { const posts = await prisma.post.findMany(); // TODO: this can cause problems if we run this the first time the database is reset...

Help me with my stack...

Hi folks, I'm prototyping a website for scores for a niche sport I play. The current popular one is some 2005 era wordpress monstrosity. This one will be nice and simple - display events, teams, players, scores, blog, news, and standings. Because of the nature of the site, there will be many pages (thousands eventually) that will change quite regularly, so I'll need to SSR. However most of the requests will be for stale data (think people refreshing the score page many times) so I'm thinking I need a solid way to cache results, either in a CDN or serverside db, in order to keep costs low (it's out of my own pocket) and also to keep the site fast. ...

Cross platform stack (web & mobile)

If you were to have one stack that were to cover both web and mobile apps where your UI, logic, BE, DB integrations and so on should be reusable across all your clients. What would you recommend as a stack for that? This is the list of what I got so far but I'd gladly take any feedback that you got on this. ...

should I use a trpc request when using getStaticPaths()?

Should I do a trpc request instead of getStaticProps or is this template fine? If the template is fine, how do I get types through my props?

best way to create reusable components with tailwind and react

i am exploring different ways to create reusable components using tailwind and react and found this https://github.com/enochndika/kimia-UI/blob/main/src/packages/button/button.tsx. is this the best way to do this?

Spot the Prisma relation error?

Hey guys, I'm trying to add a @relation in prisma but I'm forced to create use an array of elements for the model (one to many) and I want a one to one relationship here. ``` model OrderDetail { id String @id @default(cuid())...

error while developing a react component library

i'm developing a react component library, and i get this error. however it disappears when i make a change and the package re-renders (it's in watch mode)

Why should you use turborepo

I have a simple NextJs App and I recently saw the create-t3-turbo and wondered what the benefits of Turborepo are. Is it just the remote caching?

vercel gives errors when generating nextjs static pages I didn't ask to be generated during deploy

hello. I'm getting the following error: ``` 2022-10-23T06:06:28.411Z Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error 2022-10-23T06:06:28.411Z [object Promise] 2022-10-23T06:06:28.412Z info - Generating static pages (3/3)...

how do you re-fetch with react-query?

it seems that they don't have such action: `useQuery(queryKey, queryFn?, { cacheTime, enabled, networkMode,...

Getting an error saying `TypeError movies.map is not a function`

import type { GetStaticProps, NextPage } from "next"; import MovieTypes from "../types/MovieTypes"; import MovieCard from "../components/MovieCard"; // type Props = {...

Property 'useMutation' does not exist

Hello, I'm very new to T3 and pretty new to coding in general. Going through my first tutorial on youtube to build a simple application and it seems like there has been some small changes made recently in how you set up simple CRUD and I can't seem to figure it . Problem is simply that whenever I try to use tRPC's useMutation method here, it simply gives me an error saying that it "does not exist on type '{ useContext():..." despite following the tutorial. ``` const Home: NextPage = () => { const [snippetText, setSnippetText] = useState("");...

How to check if all the data from multiple components is loaded

If my page consists of multiple components that each use trpc.useQuery inside them, how should I check if all the data from them is ready to go? For example trying to do the loading screen if all the data is not ready inside my index page. To be more clear I have lets say Table and Navbar component and want to load the index page where the nav and table are if all data from them is loaded....

Is there a simple way of doing the the Blur Effect with Next-Image in MDX?

I just looked into this and it seems like such a pain to accomplish, esp. with Images in MDX? (e.g. : https://nikolovlazar.com/blog/generating-blur-for-dynamic-images-nextjs) Base64 also seems not the most beautiful of blurs and the plaiceholder docs really don't say anything about the options and what values they take. What do would you recommend?...

tRPC basics - returning an array

I suspect this is my ignorance of typescript. I am just not getting anywhere with this tRPC set up. I just want to return an array, but my query result is empty. Router `const partyList = [ { firstName: 'joe',...

am I self taught ?

Can someone who studied at a university be considered self taught ? In my situation Iโ€™d say 80% of what I know is because I took the initiative and spend time to learn new skills by myself. While I was doing that of course, I was also pursuing a Computer science degree. But after graduating I cannot say that the degree โ€œboostedโ€ me or it helped me or that it opened doors for me. But for most people that donโ€™t follow an academic career, I believe itโ€™s a similar situation for them....

database write on button click

How do I do it? I can't use trpc(can only make calls at top level), I could make an api endpoint, I tried, it's kind of awkward and looks like this: `` const callAPI = async () => { try { const res = await fetch(http://localhost:3000/api/cookbook/create`, {...

Mac Cleaner

Does anyone have some experience with mac cleaner apps?

how to fix OAuthAccountNotLinked in NextAuth (pretty way?)

AFAIK this is happening because I'm signing in using same email but different auth provider (Google, Discord, Github), is there any way to not get a error screen??

TW-Elements

Hello! I'm trying to add tw-elements to the project and I get this error:
Could not find a declaration file for module 'tw-elements'. 'c:/Users/Adek/Documents/nextjs/my-t3-app/node_modules/tw-elements/dist/js/index.min.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/tw-elements` if it exists or add a new declaration (.d.ts) file containing `declare module 'tw-elements';`
Could not find a declaration file for module 'tw-elements'. 'c:/Users/Adek/Documents/nextjs/my-t3-app/node_modules/tw-elements/dist/js/index.min.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/tw-elements` if it exists or add a new declaration (.d.ts) file containing `declare module 'tw-elements';`
...