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

react-error-boundary commit #368

Merged
merged 3 commits into from
Sep 19, 2023

Conversation

EtoKruto
Copy link
Contributor

Dev Summary

Mocks

Test Plan

repro steps:

  1. localhost:3000
  2. click X button
    expected:

Resources

@EtoKruto EtoKruto linked an issue Aug 11, 2023 that may be closed by this pull request
@marvinsjsu
Copy link
Contributor

marvinsjsu commented Sep 1, 2023

hi @EtoKruto, I was reading up on ErrorBoundary and I think you've set everything up correctly, but we're using an event handler for triggering the error, which looks like ErrorBoundary won't be able to catch (based on https://medium.com/@danhuang1202/catch-error-from-event-handler-in-react-error-boundary-f36ec58786af). I've tried locally by just throwing the error in SignInModal by doing something like ...

    ...
    const [isLoading, setIsLoading] = React.useState<boolean>(false);
    const [error, setError] = React.useState<Error | null>(null);
    const { setUser } = React.useContext(UserContext);

    if (!isLoading) {
      throw new Error('An intentional error');
    }
   ...

This will show us the error pane, which I think will always show for development (will be the ErrorBoundary when in production), but we can close it and we'll see the ErrorBoundary displayed.

Screenshot 2023-08-31 at 8 46 01 PM Screenshot 2023-08-31 at 8 46 13 PM

@marvinsjsu
Copy link
Contributor

I couldn't find this mentioned in the new React dev docs, but they do have it in the legacy site:

@EtoKruto EtoKruto marked this pull request as ready for review September 10, 2023 04:21
@EtoKruto EtoKruto requested a review from marvinsjsu September 10, 2023 04:21
@EtoKruto EtoKruto self-assigned this Sep 10, 2023
@EtoKruto
Copy link
Contributor Author

@marvinsjsu please feel free to review when you find some time. Thank you sir!

Copy link
Contributor

@marvinsjsu marvinsjsu left a comment

Choose a reason for hiding this comment

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

Aside from a suggestion and a question, this LGTM. Thanks for workin on this, @EtoKruto!

width="100vw"
justifyContent="space-between"
>
{/* move modal to below footer after troubleshooting */}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming this comment was added before you started working on this, but do you know what this comment is about?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Truly not sure, might need to go a few commits back to see the original placer of the said Modal position. I created the Modal and modal provider originally but do not remember adding the comment. I've since moved it to below footer for order but to my best understanding this doesn't directly impact its appearance or position on the screen, especially since it's styled with absolute positioning

client/src/App.tsx Outdated Show resolved Hide resolved
@EtoKruto
Copy link
Contributor Author

@marvinsjsu Please provide a quick glance on the new structure if possible - I've folderized the ErrorBound so its compartmentalized into it's own folder for additions in the future and so it's easy on the eyes.

@EtoKruto EtoKruto changed the title initial commit using the react-error-boundary react-error-boundary commit Sep 14, 2023
Copy link
Contributor

@marvinsjsu marvinsjsu left a comment

Choose a reason for hiding this comment

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

I like how you re-organized the components. It was not required, but it is very helpful as it helps keep a nice structure to our app. Thanks again, @EtoKruto!

client/src/App.tsx Show resolved Hide resolved
@EtoKruto EtoKruto merged commit f10dd4b into main Sep 19, 2023
3 checks passed
@EtoKruto EtoKruto deleted the 360-create-errorboundary-component-for-client branch September 19, 2023 08:13
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.

Create ErrorBoundary component for /client
2 participants