Skip to content
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

Unable to use browser "back" button to return to previous page #38209

Closed
ShaunSHamilton opened this issue Feb 13, 2020 · 10 comments
Closed

Unable to use browser "back" button to return to previous page #38209

ShaunSHamilton opened this issue Feb 13, 2020 · 10 comments
Labels
help wanted Open for all. You do not need permission to work on these. platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.

Comments

@ShaunSHamilton
Copy link
Member

Describe the bug
Within the learn section of fCC, I am unable to use the browser's back button to return to an earlier point in the page history. This is a minor issue, and only occurs under specific circumstances, but I wonder if it is indicative of another error in the matrix.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://www.freecodecamp.org/ or any other fCC page.
  2. Right click on the /learn button in the nav.
  3. Open link in new tab.
  4. Click on any other link pertaining to the curriculum.
  5. Be shocked and horrified that navigation history is not available.

Expected behavior
Once in the curriculum page, after navigating to any lesson within the same tab, the navigation history should be available to make use of the browser's back button to return to the curriculum.

Screenshots
GIF can be made available, if requested.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Version: 80.0.3987.100

Additional context
Please note: I am aware that opening a page within a new tab causes the navigation history to reset with that tab. This error occurs within the same tab.

@ShaunSHamilton ShaunSHamilton added the type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. label Feb 13, 2020
@ojeytonwilliams ojeytonwilliams added the platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. label Feb 13, 2020
@raisedadead
Copy link
Member

Please note: I am aware that opening a page within a new tab causes the navigation history to reset with that tab. This error occurs within the same tab.

Thanks for this additional detail.

@raisedadead raisedadead added help wanted Open for all. You do not need permission to work on these. status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. labels Feb 14, 2020
@hassaanp
Copy link
Member

hassaanp commented Feb 19, 2020

I have been trying to work on this but I have not been able to reproduce this on my local setup.

It is easily reproducible on the live site though.

@ojeytonwilliams
Copy link
Contributor

ojeytonwilliams commented Feb 19, 2020

@hassaanp I needed to build the site before I could see it locally. To replicate the production environment you can use npm run build:client. Then copy serve.json into client and finally run npx serve -c ../serve.json client/public

It should say

INFO: Discovered configuration in `../serve.json`

   ┌─────────────────────────────────────────────────┐
   │                                                 │
   │   Serving!                                      │
   │                                                 │
   │   - Local:            http://localhost:5000     │

which means it's working.

@hassaanp
Copy link
Member

Thanks, @ojeytonwilliams.
I was able to reproduce it locally. I am going to give a shot at fixing this. I believe this issue is similar to using the <a> tag in React (causes the entire app to rerender and lose state). I think there should be some workaround for this.

@ojeytonwilliams
Copy link
Contributor

That's interesting!

It may not be relevant, and I don't want to distract you, but I noticed that gatsby serve does not have this problem, while zeit/serve (what npx serve calls) does.

@raisedadead
Copy link
Member

I am more and more inclined on moving away from the zeit/serve and actually doing a docker based approach from the Gatsby docker image.

Thanks for all your investigations Oliver and Hassaan

@hassaanp
Copy link
Member

@ojeytonwilliams

Thanks for the information. Should we configure npx to use gatsby instead?
I have been trying to go through the React Tree and the network tab and diff-ing it for the direct link and the new tab link. Also going through the code as well. So far, nothing promising has shown up. I wonder perhaps this has got to do with mixing client-side and server-side rendering. This may be relevant.

@raisedadead, That sounds interesting. Let me know if I can help with that.

@ojeytonwilliams
Copy link
Contributor

Should we configure npx to use gatsby instead?

We don't use npx in production, it's just a convenient way to run serve locally. Also, according to their docs gatsby serve is only intended for testing a production build, so probably should not be used in practice.

@moT01
Copy link
Member

moT01 commented Sep 18, 2020

Is this still an issue for you @SKY020? I cannot reproduce this after a quick test.

@ShaunSHamilton
Copy link
Member Author

@moT01 No. Seems to magically have gone away. Thanks, for checking.

@ilenia-magoni ilenia-magoni removed the status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. label Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Open for all. You do not need permission to work on these. platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.
Projects
None yet
Development

No branches or pull requests

6 participants