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

SFR-2136: Implement error boundary #522

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

jackiequach
Copy link
Collaborator

Jira Ticket

This PR does the following:

  • Implements error boundary for uncaught exceptions

Testing requirements & instructions:

Copy link

vercel bot commented Aug 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sfr-bookfinder-front-end ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 27, 2024 7:38pm

@kylevillegas93
Copy link
Contributor

The change looks good. Should the error boundary work for all uncaught exceptions? When running locally and navigating to http://localhost:3000/edition/1 I see the following:

Server Error
Error: cannot find work with identifier 1

This error happened while generating the page. Any console logs will be displayed in the terminal window.

@kylevillegas93
Copy link
Contributor

After running npm i; npm run build; and npm run start everything looks good!

@Toxiapo
Copy link
Contributor

Toxiapo commented Aug 29, 2024

The change looks good. Should the error boundary work for all uncaught exceptions? When running locally and navigating to http://localhost:3000/edition/1 I see the following:

Server Error
Error: cannot find work with identifier 1

This error happened while generating the page. Any console logs will be displayed in the terminal window.

@kylevillegas93 React's error boundary only catches errors during component renders, things like a failed fetch request or syntax errors within the component itself, and doesn't catch routing level errors so this should be fine.

However, I believe this could still be a bug where an invalid URL should show the 404 page in the pages/404.tsx instead of a generic 404 page from the browser, what do you think? @jackiequach

@jackiequach
Copy link
Collaborator Author

@Toxiapo Kyle and I spoke offline about this. The API files need to be updated to properly throw the correct status code and will be addressed in the future.

Copy link
Contributor

@Toxiapo Toxiapo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Toxiapo
Copy link
Contributor

Toxiapo commented Aug 29, 2024

@jackiequach, this isn't directly related to this PR, but I noticed a small UI bug. When searching for a book, the skeleton loader seems to cover the whole screen, which makes it look like the page is broken. Thought I'd mention it!

Screenshot 2024-08-29 at 10 44 44 AM

@jackiequach jackiequach merged commit 2cd719e into development Aug 29, 2024
8 checks passed
@jackiequach jackiequach deleted the SFR-2136/add-error-boundaries branch August 29, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants