ClassClock icon indicating copy to clipboard operation
ClassClock copied to clipboard

Navigating directly to a page leads to a 404

Open MoralCode opened this issue 4 years ago • 4 comments

To Reproduce Steps to reproduce the behavior:

  1. click this link to https://web.classclock.app/settings.html

Expected behavior Either settings page should be visible if you have already selected a school or you should see a prompt to select a school.

Actual behavior 404 Error

this seems to be an issue with the redux-first routing model that classclock uses.

this card on the roadmap partly references this problem, but is also combined with the issue of needing to automate builds

MoralCode avatar Dec 01 '20 21:12 MoralCode

the reason this happens is because there is no context to opening the file. this means that It can't be opened because it should not even be ready.

polygonnedpotato avatar Dec 01 '20 22:12 polygonnedpotato

you mean like this? https://stackoverflow.com/questions/46056414/getting-404-for-links-with-create-react-app-deployed-to-github-pages#46060999 or https://create-react-app.dev/docs/deployment/#serving-apps-with-client-side-routing

When you enter a new URL into address bar of the browser or refreshes the page, browser requests server (in this case GitHub pages server) for that URL. At this point, client side router (react-router) can't take action as it is not yet loaded for that page. Now server looks for a route that matches /accounts won't find it (because routing is done on client side) and returns 404.

Get GitHub pages to redirect to index.html on all requests. Basically you have to add a 404.html in your build directory with code to redirect to index.html. More on how to do that.

MoralCode avatar Dec 01 '20 22:12 MoralCode

switching from universal-router to https://github.com/mksarge/redux-json-router#usage may also fix this and provide additional benefits like allowing for a wildcard route path that can lead to a custom classclock-style 404 page on invalid routes.

MoralCode avatar Dec 01 '20 23:12 MoralCode

This is fixed in the dev branch and will be part of the next release

MoralCode avatar Sep 05 '21 00:09 MoralCode