NASA-PDS / doi-ui

The web interface for the PDS DOI Service providing the ability management PDS archive DOIs. See the DOI Service for more details on the available capabilities. https://nasa-pds.github.io/doi-service/
Apache License 2.0
0 stars 4 forks source link

Navigation Fix #70 #74

Closed eddiesarevalo closed 3 years ago

eddiesarevalo commented 3 years ago

Fixed navigation error #70

This was done by changing BrowserRouter to HashRouter.

BrowserRouter is required to include the basename in the code. Since we do not know where the app will be deployed ahead of time the BrowserRouter solution won't work for us.

BrowserRouter needs to know the basename for the reason that http requests must know to go to /basename first. A simple example is as follows: You are at dois/search. If you refresh the page, an http request is sent to dois/search. There is nothing there because your app is located at dois/ so you will get a 404 not found. The server would have to know to redirect dois/search to dois/ so that your app can pick it up and do a client side transition to dois/search.

We can assume we don't have control over the server so BrowserRouter is not an acceptable solution.

HashRouter uses a # to transition to different server side renderings. For example a request to dois/#/search will always go to dois/ first then transition to dois/#/search. This is sufficient for our use as the browser back and forward buttons work, refreshes work and we are not worried about SEO for this app.

fixes #70