Duplicate Requests in Next.js vs 14 on server side with Parallel Routes and Intercepting Routes #66384
Unanswered
Semmy99
asked this question in
Show and tell
Replies: 2 comments 3 replies
-
I think your environment is in development mode, causing components to render twice due to React's Strict Mode. This might be causing the fakeRequest function to be called twice. To resolve the issue, try testing in production mode. pnpm build && pnpm start |
Beta Was this translation helpful? Give feedback.
3 replies
-
Having the same issue here. When using parallel routes and rendering them in the layout component, requests are doubled for some reason. For me it happened when using two or more parallel routes. transforming the routes back to basic components solved the issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I'm using Next.js 14 and encountering an issue where my requests are being duplicated when using parallel routes and intercepting routes.
I'm not using useEffect and the RootLayout component is only supposed to render once. However, the fakeRequest is being made twice. What could be causing these duplicate requests and how can I prevent them?
I've discovered that a problem arises when using parallel routes and intercepting routes in Next.js.
Any insights or solutions would be greatly appreciated!
![IMG_2625](https://private-user-images.githubusercontent.com/25082057/335373268-d222c74e-6da0-4b62-9432-e6bd7ee29939.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5OTkzNTEsIm5iZiI6MTczODk5OTA1MSwicGF0aCI6Ii8yNTA4MjA1Ny8zMzUzNzMyNjgtZDIyMmM3NGUtNmRhMC00YjYyLTk0MzItZTZiZDdlZTI5OTM5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA3MTczMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJhNGVjNTg0NWRjMDA2MWNhYjAwMjlhZjc0ZjA4ZDhlYzA2Y2JkMDlkMDM5NTdlYTIxMzdjZDdmZjRhYzNmY2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.3C_6l18R9J8xNmT7vYDgyOEvMqh7iTOvOx6j5WVqYP4)
Additional information
No response
Example
https://codesandbox.io/p/devbox/nextjs-test-fkl7l5
Beta Was this translation helpful? Give feedback.
All reactions