bettersg / Mendisphere

Front end for Mendisphere
4 stars 5 forks source link

bug: Non-root React Pages return 404 error #90

Closed c6z3h closed 1 year ago

c6z3h commented 1 year ago

Test Steps: Access a non-root route (eg. https://mendisphere-test.web.app/organisations ) Actual Behavior: Firebase 404 error returns. Expected Behavior: Go to organisation listing page.

Investigation:

  1. This is because on React's first render, we only get the index.html which points to root route ( https://mendisphere-test.web.app ). JS only loads after that, which provides the Client-side react-router-dom to access non-root routes like ( /organisations/ ).
  2. This discussion has some possible solutions, with pros and cons discussed https://stackoverflow.com/a/36623117 .
  3. Tried to explore if Firebase has a handler for this, read about Dynamic Links here https://firebase.google.com/docs/dynamic-links/custom-domains#priority_order but I don't think that's it.

Actions Required:

  1. Investigate further if Firebase has a handler for such.
  2. If a cheap solution in the stackoverflow post is acceptable, implement it.
karthik-Jay commented 1 year ago

image

c6z3h commented 1 year ago

image

This new issue is fixed. Now just the 404 error is left