Next.js Discord

Discord Forum

conditional rendering with url search params and server side data fetching

Unanswered
! AlexNotTheLion posted this in #help-forum
Open in Discord
I have a modal which is shown based on url params "?modal=friends", I would like to use as much server side data fetching as possible as it makes a nicer user experience, the modal should fetch the users friend list from supabase and then conditionally render either a dialog for desktop or a drawer for mobile (both shadcn components), ideally id like to avoid waterfalling components. so far I've tried.

1. parallel routes (completely broken and don't hot reload on changes, i had to completely restart the dev server to see changes)

2. doing client side data fetching which is slow and only fetches on render, i would like to fetch the data before the dialog / drawer is mounted

the questions i have are:

1. is there a way around this without having a really gross waterfall architecture

2. are parallel routes just completely the wrong thing here as i dont actually have routes to navigate to

3. am i just being a moron and theres something completely different i should be doing instead

0 Replies