Router.push not working as expected on the build
Unanswered
Barbary Lion posted this in #help-forum
Barbary LionOP
I am going to use router.push from next/navigation for shallow routing. it is working as expected on localhost, but after I deploy onto the Sandbox, it works not correctly.
On sandbox, router.push refreshes the full page and reset the State of this page component.
Plz help me.
On sandbox, router.push refreshes the full page and reset the State of this page component.
Plz help me.
21 Replies
Barbary LionOP
I mean deploy on the AWS
and used sandbox for nameservice
Does it work correctly on a local build? As in npm run build && npm start
Barbary LionOP
yes
Check console for CSP errors, and when using the browser console also enable the log to persist between page refreshes. There's some error with the nextjs JS being sent to you, so it falls back to a browser refresh on navigation.
I had a chrome extension doing this when I was developing locally, chrome console told me:
Failed to fetch RSC payload for http://localhost:3000/foo?query=bar. Falling back to browser navigation. TypeError: e.url.indexOf is not a function
Error: e.url.indexOf is not a function
at y (chrome-extension://somethingwrittenhere/js/inject.js:1:6216)
// snipBarbary LionOP
yeah, right. it is working as you said. So how to fix this?
So you're getting an error saying failed to fetch RSC payload?
If that's the case then follow the stacktrace
In my case it was a chrome extension
So the solution was to disable the extension and write a bug report to the dev
Barbary LionOP
what is RSC?
In all other browsers, not working.
React Server Component
Barbary LionOP
Even on Guest Browser, not working.
what should i do? here is the err msg
GET https://sandbox.chainq.com/bookmarks?_rsc=19pha 500 (Internal Server Error)
Navigated to https://sandbox.chainq.com/bookmark\
How can I make it just navigate into https://sandbox.chainq.com/bookmark
The error message says there's an internal server error, so you'll need to check your server logs as to why it's not working.