unexpected page refresh
Answered
Great Auk posted this in #help-forum
Great AukOP
I have a search route, when I enter the page it automatically refreshes, it doesn't make sense.
I have the application online at: https://jounin.live
Just search for something, I'll leave the code below.
I have the application online at: https://jounin.live
Just search for something, I'll leave the code below.
23 Replies
Great AukOP
page.tsx
Great AukOP
there are no errors in the logs and this doesn't happen in development mode, only in production
@Great Auk there are no errors in the logs and this doesn't happen in development mode, only in production
npm run build && npm run start on locally
@Ray npm run build && npm run start on locally
Great AukOP
âš Entire page /search deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /search
Answer
but I would turn the page to server component instead
@Ray wrap your page with `Suspense`
Great AukOP
can you help me with anything else? In dev mode my project in nextjs is very slow, because these rsc requests always cost a few seconds of page load. Is this normal?
this is almost making me go back to normal reactjs, it's too slow in all projects
@Great Auk can you help me with anything else? In dev mode my project in nextjs is very slow, because these rsc requests always cost a few seconds of page load. Is this normal?
1. try to use
2. use data cache for the db query with
3. split the data request and wrap it with
cache from react to dedup the function2. use data cache for the db query with
fetch or unstable_cache3. split the data request and wrap it with
Suspense if the data doesn't appear on the first screen eg. recommendation@Ray wrap your page with `Suspense`
Great AukOP
didn't work
@Ray but I would turn the page to server component instead
Great AukOP
example?
so you don't need
useSearchParams thereisDesktopView can handle with cssturn SearchForm in client component and push the route inside it
or move
useView to SearchForm tooif (isDesktopView) return nullthe title can be changed with [generateMetadata](https://nextjs.org/docs/app/api-reference/functions/generate-metadata#generatemetadata-function)
Great AukOP
it worked
[cache](https://react.dev/reference/react/cache#noun-labs-1201738-(2))
[unstable_cache](https://nextjs.org/docs/app/api-reference/functions/unstable_cache)
[streaming with suspense](https://github.com/vercel/next-learn/blob/646898bc52d2bc22be9019871cf111e31b29d147/dashboard/final-example/app/dashboard/(overview)/page.tsx#L19)
[unstable_cache](https://nextjs.org/docs/app/api-reference/functions/unstable_cache)
[streaming with suspense](https://github.com/vercel/next-learn/blob/646898bc52d2bc22be9019871cf111e31b29d147/dashboard/final-example/app/dashboard/(overview)/page.tsx#L19)