Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting 404 Page Not Found on refresh, when using parallel routes

I am creating this webapp dashboard in Next js 13 latest version with app router. it have dashboard and search bar on top. I tried to use parallel routes. @search folder search bar and page.jsx contains dashboard. When ever i am using link from side bar it is working properly but if refresh the page it shows 404 Not Found.

enter image description here

@search folder contains searchbar

enter image description here

when using with sidebar links it working properly

enter image description here

but if i am refreshing the page i am getting 404.

enter image description here

Everything is working flawlessly in component system.

can any help me with this parallel routes.

I am trying to put search bar and dashboard in same page by using parallel routes introduced by nextjs 13. but it is working as expected but not on refresing the page.

I tried component way it is working but i want to use parallel routes for sharing data between server components.

like image 639
Aman Avatar asked Dec 14 '25 06:12

Aman


1 Answers

Try to move all the content inside @search/page.tsx to default.tsx, and remove the page.tsx.


before

@search
- page.tsx

other answers may be suggesting

@search
- page.tsx
- default.tsx

where default.tsx could be as simple as

export default function Default() {
  return null;
}

that could probably fix the 404, however, other grouped pages may won't find @search/pages.tsx well. If you don't really need the segmentation, actually you can use default.tsx without page.tsx as below.

after

@search
- default.tsx

worked for me for both the root route and other sub-grouped routes.

like image 73
keikai Avatar answered Dec 16 '25 22:12

keikai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!