ayr-ton/kamu

Opening an invalid library has unexpected behavior on the frontend

Closed this issue · 1 comments

If you try to open the page of a library that does not exists, like /libraries/blablabla, it does not display an error. In fact, it throws a console error trying to parse the response from the API, because the API returns a 500 status code with an HTML error message, when the front-end is expecting an application/json response.

Additionally, the frontend will also cache the current library, which means in this case it will cache the invalid blablabla library as the default when the user returns to Kamu, instead of not caching it or keeping the previous one on the cache.

Expected behavior

  1. The API should return a 404 instead of a 500
  2. The frontend should display the standard error page from ErrorBoundary when a parsing error occurs
  3. The frontend should not set an invalid library as the user's current library
  1. Fixed
  2. The error boundary won't be called by design, this is a limitation on React handling asynchronous code. An error boundary will only catch errors in the rendering of components.
  3. Fixed