-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show Progress Bar on Back #1503
base: master
Are you sure you want to change the base?
Conversation
// (2) is not possible while intercepting nav with beforePopState | ||
router.replace({ | ||
pathname: router.pathname, | ||
query: { ...router.query, nodata: true } | ||
}, router.asPath, { ...router.options, shallow: true }).catch((e) => { | ||
}, router.asPath, { ...router.options, shallow: false }).catch((e) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably has implications elsewhere in the app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes this will cause the data to load twice on every page visit. no go with this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that shallow is intentional, I think you'll want to make nprogressStart
and nprogessDone
make an exception for back navigation if possible rather than changing the behavior of every router.replace operation.
Thanks. The current behaviour is very strange though... if you go to a post from the homepage and then go to your profile page then click back twice it will show the progress bar for both backs. |
Are you saying we shouldn't have progress bars on back nav? Maybe this is the wrong solution to the right problem. The problem we have is that nextjs wants to hit the server on back nav because we SSR content. Ideally nextjs wouldn't do that, but at least when this |
My last comment was just to say that if you navigate deeper into the app and then use the back button then you will see a progress bar. But if you just go to a post and then back then you won't - that's the strange behaviour. I did look into |
Fixes #1471
Observations before fixing
Attempted Solution
The issue lies with the passing of
shallow: true
in_app.js
.This PR offers the quick fix of
shallow: false
but I would assume this has implications elsewhere in the app?