Next.js Discord

Discord Forum

Make a parallel route for a comment section page which is part of blog page that is a parallel route

Answered
HOTCONQUEROR posted this in #help-forum
Open in Discord
As the title said, and the image describe how the folder structure is set

Note that i have blog folder, which render the content inside a modal, the modal is set inside page.tsx inside [id] of (.)blog folder, the parallel route happen between a blog modal and the main page.tsx (home page).

Another Note, the comment section is also a modal that is part of blog modal, but comment section need to have a different route rather than being in the same page as blog.


Give me some suggestions!
Answered by Jboncz
Exactly, lazy load or use suspense on the comment component so it doesnt stop the blog from rendering
View full answer

21 Replies

Just curious, why do you want to have the comments have its own route?
@Jboncz Just curious, why do you want to have the comments have its own route?
I was thinking, it would be easier for me to control the comment section if it was on a separate route, my reason is vague atm tbh.
If it was me, I wouldn't personally do it this way. Also you dont use parralel routes in your implementation your using Intercepting Routes and Dynamic routes
Unless im misinformed
oh also, i have server comp for fetching data, i need a client comp for when user make comments (post requests to send payload and managing states...etc)
for modals, you have to use intercepting routes in order to make modals work functionally with parallel routes, i am not sure the reason why, but that what the documentations said.
whew 😄 It almost feels like you just want to use all the different kinds of routes. Are you open to suggestions that arent how you are currently implementing it?
Or are you wanting to do it this way specifically.
@Jboncz whew 😄 It almost feels like you just want to use all the different kinds of routes. Are you open to suggestions that arent how you are currently implementing it?
all i want to do is a blog modal that is being a parallel route, and then comment section is part of blog modal, from there you can make suggestions 😛
okay, so why not just make the comment section its own component in the blog modal?
@Jboncz okay, so why not just make the comment section its own component in the blog modal?
so, a separate server and client component for comment section on the same route of blog?
Exactly, lazy load or use suspense on the comment component so it doesnt stop the blog from rendering
Answer
@Jboncz Exactly, lazy load or use suspense on the comment component so it doesnt stop the blog from rendering
if you are talking about auth, yeah, i will definitely have loading component for blog modal

and conditional rendering to show either login button or comment section for user being auth or not.
Uhhhhh like the client wont load the component till its needed essentially. Might not be the play here.
So the suspense boundary would allow the blog component to render before the comment component is 'ready'
@Jboncz Uhhhhh like the client wont load the component till its needed essentially. Might not be the play here.
i gotcha

I guess that answer my question here, i still have another question in another thread, should i re-ask it here, or can i ping you there? Thanks for your help 🙂
it is part of the parallel route problem of blog though
You can ping me, I will look.