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

Forms: How would you go about updating relations from the frontend?

(long-ish post) I'm currently building an admin dashboard, where you can manage users for example. A user can be edited by going to /dashboard/users/<userid>, and there I fetch the whole user object including relations (role object, permissions object). ```javascript model User {...

queryClient type errors when adding default options to queryclient

```ts export const TRPCProvider: React.FC<{ children: React.ReactNode }> = ({ children, }) => { const [queryClient] = React.useState(...

how to work with tailwind intellisense on vs code

it's virtually unusable since the only way I can trigger suggestions is to kick it off with a whitespace. If I have something like text- already and remove the hyphen, I don't get any suggestions, but have to delete everything before I can get any suggestions. Is there some usage pattern I'm missing? the one I'm using is bradlc.vscode-tailwindcss

Deploying NextJS to GCP and using IAP

Has anyone ever deployed NextJS and added a IAP to require login before serving any files? I'm looking to see if I can deploy my NextJS app this way alongside a db that's also tucked away behind IAP.

How to avoid duplicate code in getServerSideProps?

Hey guys, sort of off-topic but lets say I have multiple components with getServerSideProps like this: ``` export const getServerSideProps = async (ctx: GetServerSidePropsContext) => { const supabase = createServerSupabaseClient(ctx); const {...

Off-Topic Animating using Framer

I'm trying to build a vertical carousel in react and I'm really stuck on how to actually animate the position changes ```ts import { type NextPage } from "next"; import Head from "next/head";...

trpc/react-query render logic

I've made the attached diagram to try and explain the scenario, but for additional context, my issue is this: I have a page that conditionally renders two main views. the editable view submits a form, after which I would like to render the opposite view, but with the new data. currently, i'm invalidating on success, though it seems that the completion of invalidate doesn't ensure that my other component will have refetched its data yet. my idea would then be to block my readonly component on both loading AND fetching. the issue here is that toggling between views when there is not a form submission ends up showing a load state, presumably because isRefetching is true even if its fetching from cache. ...

Add custom background from file with tailwind

I would like to add custom background to website via local file and I used this <div class="bg-[url('/your/image.svg')]"> <!-- ... --> </div> Doesnt work...

Not sure if data is being exposed to the client

Hello team, I have the following Supabase JS client which should not be exposed to the client. ``` // pages/api/supabase.ts import type { SupabaseClient} from "@supabase/supabase-js"; import { createClient } from "@supabase/supabase-js";...

Deployment on AWS

Hello, I want to deploy my t3 app with a postgres db on aws using the free tier. Is dockerizing the project and using ECS the easiest option?

How could I create a multi-tenant application with the T3 stack?

Hi, I want to build a new startup, and I am feeling a little bit lost as to where to start. I know generally what I want to build, but honestly I feel like I get stuck on some problems I want to build a product that has two main areas: ...

prevent content blink

is there a way to prevent content blinking from user if not logged in

Data operations in tRPC router

Hi guys, I'm wondering if a router is a good place to operate on data. That's a dummy example, it works. But in more complicated calculations is it a good practice?...

how to do page transitions when using router.push

i tried using framer motion and animate presence is very good when using Link,however i am using amazon cognito and have a login page where i want to redirect user back to homepage when cognito onSuccess is triggered and i am doing that with router.push

get icon from mui dynamicly

hello im trying to dynamicly load icon from mui this is the code import React from "react"; import * as MuiIcons from "@mui/icons-material"; console.log("MuiIcons: ", MuiIcons); ...

Typing Props

I have a query that is returning an array of items. I'm then mapping over that array and rendering elements in a child component. I did some wacky stuff to get the type from the api but that felt VERY wrong. Currently just passing an id and refetching inside the child, but that also seems wrong. What is the best practice here?

Why does react rerender this at the component level but not when using a hook?

I've been toying with a type-writer effect in react and cant understand why react's lifecycle is working this way. Can someone explain why react is re-rendering the <WithoutHook/> component such that it doesnt work While the <WithHook/> one does? ...

getServersideProps not providing type inference, and session getting lost between server and client

I have this function (which I've used many times before), ```ts export const getServerSideProps: GetServerSideProps = async (ctx) => { const auth = await getServerAuthSession(ctx); if (!auth?.user) {...

middleware does not run on index page

Here's the middleware config ```ts export const config = { matcher: [ /*...

should I use ctx or api?

whats the difference between me using api.events.getEvent.cancel() vs ctx.events.getEvent.cancel()? why does one work and not the other? isn't api in ctx, so shouldn't I be able to just use api and not ctx? which one should I be using?...
No description