Next.js Discord

Discord Forum

Parallel routes

Unanswered
American Crocodile posted this in #help-forum
Open in Discord
American CrocodileOP
hello guys

I create a site where the shopping cart opens at "/cart"

how to implement this behavior: the user clicks on the cart icon, the url becomes /cart and a modal window opens with the cart, but the content that was there before clicking on the cart icon remains under the modal window

I know about 'Intercepting Routes', but the problem is that when I refresh the page, the content under the cart is not visible, and I need it to always be visible, no matter if I refresh the page or not.

For example, I have the address /clothes, where the list of clothes is displayed. I click on the cart icon, the address becomes /cart, but the content that belongs to /clothes remains under the modal window.

If I refresh the /cart link, the main page opens with the shopping cart modal window open.

1 Reply

when you refresh the page the route is not intercepted (going from / to /cart). I wish they cover this case in the NextGram code sample.