showduhtung
showduhtung
TTCTheo's Typesafe Cult
Created by showduhtung on 12/27/2024 in #questions
how to pass searchParams around in next app server components?
I feel like this answer to trim down the server components tree into client components is just not a scalable solution. I have this one page that has like 12 queries going on, each pretty expensive, so I've opted to componentize them to localize and parallelize the queries. This also opens me up to use Suspense around them, for nice loading states. But with them so spread out, I'm finding myself passing searchParams to each and every component. Some parts it goes 3-4 layers down, which imo looks really stupid, especially when there's already a solved solution client side. And since url is considered to be the dynamic state of choice, I just wish there was some way to hook into it.
13 replies
TTCTheo's Typesafe Cult
Created by showduhtung on 12/27/2024 in #questions
how to pass searchParams around in next app server components?
Yeah, this looks similar to my alternate solution to use history.push .
13 replies
TTCTheo's Typesafe Cult
Created by tyler4949 on 12/24/2024 in #questions
shadcn Dialog - "submit" vs "cancel"
Few things I've done to achieve what you're looking for 1. Clear the form when form unmounts- which will happen either when the dialog closes naturally, or the form saves, and you close it manually. So a simple `useEffect(() => () =>form.clear(), []) 2. Created a ControlledDialog, which is a wrapper around Dialog, that passes a context with values of open state and a toggle close function to children. So when the form is completed and saved, I'll toggle it close. This decouples submit/cancel from the dialog's close behavior.
6 replies
TTCTheo's Typesafe Cult
Created by showduhtung on 12/27/2024 in #questions
how to pass searchParams around in next app server components?
Tried nuqs, but nuqs' cache doesn't update on history replace
13 replies