r.omaarr
r.omaarr
Explore posts from servers
TTCTheo's Typesafe Cult
Created by r.omaarr on 11/17/2024 in #questions
Data Fetching Patterns for User Session
What approaches do you typically use for data-fetching in multitenant applications built with Next.js 14+? Specifically for managing things like the current organization, user profile, or dynamic navigation links: Do you store some state in the URL (e.g., organization ID)? Do you prefer using a global state management library? Or do you keep it simple with plain RSC (React Server Component) fetching through server actions? I understand the choice depends on the use case, but I’d love to hear your recommendations and what has worked well in your experience.
2 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 2/25/2024 in #questions
Prisma Imports bundle sizes too big?
No description
4 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 2/4/2024 in #questions
Avoid Grid Borders from doubling
No description
4 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 10/24/2023 in #questions
global.css location for shadcn
No description
2 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 9/21/2023 in #questions
User onboarding pattern
What examples are you using when you have to onboard a client before he proceeds to use the app. Once an account is signed up, the user will have to answer a few questions/forms. I've seen a lot of bigger apps do it but there are so many edge cases to think about: Do i use a middleware to check if the new user finished onboarding and redirect him? How do i manage the state to persist it in the db so that in case the connection is lost he picks up where he left off.
2 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 9/8/2023 in #questions
Access clerkId inside upload thing callback
If the uploadthing webhook callback runs on the server wouldn't it make sense that i could still use my clerk auth hooks to get the user data? My file router looks something like this:
export const ourFileRouter: FileRouter = {
csvUploader: f(["text/csv"]).onUploadComplete(async ({ metadata, file }) => {
const createdTask = await createAddTask(file.url);
if (createdTask) {
console.log("Task created");
}
console.log(JSON.stringify(file));
}),
} satisfies FileRouter;
export const ourFileRouter: FileRouter = {
csvUploader: f(["text/csv"]).onUploadComplete(async ({ metadata, file }) => {
const createdTask = await createAddTask(file.url);
if (createdTask) {
console.log("Task created");
}
console.log(JSON.stringify(file));
}),
} satisfies FileRouter;
createAddTask has this call:
export async function createAddTask(filename: string) {
const user = await getUserByClerkID();
export async function createAddTask(filename: string) {
const user = await getUserByClerkID();
getUserByClerkID:
export const getUserByClerkID = async (select = { id: true }) => {
const { userId } = auth();
const user = await prisma.user.findUniqueOrThrow({
where: {
clerkId: userId as string,
},
select,
});

return user;
};
export const getUserByClerkID = async (select = { id: true }) => {
const { userId } = auth();
const user = await prisma.user.findUniqueOrThrow({
where: {
clerkId: userId as string,
},
select,
});

return user;
};
I think it has something to do with it not running in a place where it get context about the user. Would love any heads up or pointers to where i'm making a mistake/any docs i could read for further clarification
1 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 2/19/2023 in #questions
Remote Markdown Best Practices
Any best practices when fetching remote markdown from a headless cms? If there is a project/article/video which covers this topic, i'll greatly appreciate it. Or some common mistakes / design patters to use to create maintainable and better code. Thanks!
2 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 1/22/2023 in #questions
Flex box full width
5 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 1/17/2023 in #questions
Managing data fetching in Astro
How do you guys manage data fetching in an astro SSG website. I have some pages which will reuse content (currently fetched from a CMS API). Should i add a fetch statement at the top of each component or breakup the data into another folder and import it from there while creating some utility script to refetch new data? Any good pointers on how i should approach this problem?
2 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 1/9/2023 in #questions
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.
7 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 11/19/2022 in #questions
How to use tailwindui app shells with t3
I am not sure on how i would go implementing a tailwind ui application shell. Usually i would just add my header and footer components between <Component {...pageProps}> but i keep getting errors related to the way useState is different between the one rendered on the sv and the client one. Tried looking at nextjs docs for a way to add the layout but cant figure out what type i should give my component. If any of you have a repo that implements it or anything i could use i would truly be grateful thanks
1 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 11/18/2022 in #questions
Filter Query with multiple parameters
What is the recommend approach when creating a query that needs to filter based on some conditions which may or may not exist (if the user doesn't specify them we should ignore the filter rule) while using prisma? Something like /posts?category=a&tag=b Should filter posts with a category and tag b
8 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 11/4/2022 in #questions
T3 for SSG
Does anyone have an example project of a T3 App using SSG? Reading the docs, i am not sure if i should add the SSG Helper context (https://trpc.io/docs/v10/ssg-helpers) somewhere in where the TRPC Settings are defined and have them be imported directly from utils/trpc.
19 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 10/29/2022 in #questions
Send default value along with form instead of empty string
3 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 10/27/2022 in #questions
How to change the input type in trpc call
9 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 10/25/2022 in #questions
Importing country codes as an enum
What solutions do you recommend to deal with country field for a user profile? i was thinking about creating an enum file in the utils which i could use to import both on the frontend and the backend (prisma / postgres ) but the docs mention only hardcoding enums in the prisma.schema field (https://www.prisma.io/docs/concepts/components/prisma-schema/data-model#defining-enums) What is the best approach to avoid duplicate code? Any tips would be appreciated! Thanks!
3 replies
TTCTheo's Typesafe Cult
Created by r.omaarr on 10/24/2022 in #questions
Type Inference with T3 Stack
21 replies