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

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(),...

Saving filter state to query params

Does anyone have any experience using Geschichte with nextjs? I need to save the filter state to query params but it seems kind of overkill plus throws an erroneous type error. Should I just use Zustand and write my own simple persistence store? https://github.com/BowlingX/geschichte...

Wrapper around Next Image component

I am trying to built a component which uses the Next Image component inside currently I have done this, but I don't like how I pass the props down is there a better solution for this? ```ts interface ImageFromBucket { props: ImageProps;...

Great next+tailwind landingpage for an app?

I'm looking to create a simple landingpage for my app using next.js + tailwind, however I'm struggling to find a good-looking (and preferably free) landingpage template for this stack. Most templates online use bootstrap or some other crap. Does anyone have some recommendations / resources?...

nextAuth - Add to the user model

https://next-auth.js.org/adapters/models Hello, I'd like to add modify the user before it comes into the session callback in [..nextauth] ``` callbacks: {...

Data fetching strategy with Next.js for a dashboard-like app

Hi I hope this is the right place for a discussion like this 🙂 In the past, I was mainly developing mostly static websites with a few interactive elements. Now I'm planning to do a personal project with a more app-like behaviour and was wondering what the best practice is regarding data fetching with Next.js, especially with the T3 Stack....

Parent model in child model in Prisma?

Sorry for the confusing title, I'm looking to do something like this: ```ts model Parent { id String @id @default(cuid())...

Noob Question Many-to-Many in prisma after nextAuth

Hello all! I'm trying to create my first many-to-many relationship in Prisma. schema: ```schema...

Proper way to handle a protected route with react-query

Greetings all, I need to protect a specific page and show it users only if they have a certain "status" which is fetched through a simple query to the server. See this code example for reference: ``` import React from "react"; import { api } from "../utils/api";...

Custom data fetching hook

Hey guys, It would be really helpful if someone can provide some examples as to how to configure a custom data fetching hook, such that it returns repeat queries from cache directly, ...

Why am I getting these TypeScript ESLint errors even though VSCode doesn't complain?

Here is my repo. It was bootstrapped with create-t3-app: https://github.com/ChromeUniverse/luccanotes And here is the full output of npm run lint: ``` ...

Why useQuery runs multiple times?

my first time of using react query and facing issue of running API request multiple times, I dont know what causes this issue am I doing anything wrong? ```ts export const sendAuth = async ({ token }: { token?: string }) => {...

Is these animations a lot for a library like react?

I want to make an algorithm visualizer, like this one: https://www.toptal.com/developers/sorting-algorithms I found this lib called framer-motion. I might be wrong but it seems that I need to re-render a lot to be able to build the project above. I probably need charts because it's animating based on data. but I don't know a charting lib that is flexible enough....

TRPC + Redis

Hey Guys, I'm exploring using redis to make my data real time and using trpc as a rest like API. I was reading through the trpc section on subscriptions and it seems like there should be a way to integrate redis directly into TRPC, but would that require me to have a websocket server active to manage it? Is it better to just not use TRPC subscriptions and just build the pub/sub logic into my state management?...