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

fix: settings error layout #7674

Merged

Conversation

harshrajeevsingh
Copy link
Contributor

@harshrajeevsingh harshrajeevsingh commented Oct 14, 2024

Fixes: #7460

Screenshot from 2024-10-14 15-27-52

Changes & Why

Since all the settings pages lie in the Outlet of DefaultLayout, there was no way to handle it apart from creating a separate errorFallback for the settings route.
So, I created a settingsErrorFallback component that uses the same styling of settings pages.
Created ErrorBoundaryWrapper that checks if its settings route then show SettingsErrorFallback else show GenericErrorFallback.
Now, for the breadcrumb part. I found that all the settings pages use hardcoded title. So, I created generateBreadcrumbLinks function that will provide different title and links based on how it's respective settings page has them.
If this approach looks fine, I will add the other remaining titles and links to the generateBreadcrumbLinks function and move that whole function to its separate file. And will fix linting errors.

If there is any different approach to handle it, lemme know. I'm happy to implement it.

@harshrajeevsingh
Copy link
Contributor Author

@charlesBochet I need your review on this.

@harshrajeevsingh harshrajeevsingh marked this pull request as ready for review October 17, 2024 05:30
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This pull request introduces a new error handling approach for settings pages, improving the user experience and error reporting.

  • Added SettingsErrorFallback component with dynamic breadcrumb generation for settings-specific error pages
  • Created ErrorBoundaryWrapper to conditionally render appropriate error fallbacks based on route
  • Modified AppErrorBoundary to use Sentry for exception capturing and support different fallback components
  • Updated DefaultLayout to use the new ErrorBoundaryWrapper for consistent error handling across the application
  • Implemented error reset functionality when navigating between different settings pages

4 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

<AnimatedPlaceholder type="errorIndex" />
<AnimatedPlaceholderEmptyTextContainer>
<AnimatedPlaceholderEmptyTitle>
Server’s on a coffee break
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Server's on a coffee break

}
}, [previousLocation, location, resetErrorBoundary]);

const generateBreadcrumbLinks = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider moving generateBreadcrumbLinks to a separate utility file for better organization and reusability

</AnimatedPlaceholderEmptySubTitle>
</AnimatedPlaceholderEmptyTextContainer>
<Button
Icon={IconRefresh}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: title prop is not typically used with Button component, consider using children prop instead

@lucasbordeau lucasbordeau self-assigned this Oct 18, 2024
@lucasbordeau
Copy link
Contributor

@Bonapara Should we implement this not only in settings but everywhere in the app ?

@Bonapara
Copy link
Member

@Bonapara Should we implement this not only in settings but everywhere in the app ?

CleanShot.2024-10-18.at.19.02.25.mp4

Don't we already do this?

@Bonapara
Copy link
Member

Fixes: #7460

Screenshot from 2024-10-14 15-27-52

Thanks for contributing @harshrajeevsingh! Can you remove the Error Occured page title?

@harshrajeevsingh
Copy link
Contributor Author

Fixes: #7460
Screenshot from 2024-10-14 15-27-52

Thanks for contributing @harshrajeevsingh! Can you remove the Error Occured page title?

Yeah! I will remove it.
@lucasbordeau any suggestion from your side? Also in which folder should I move the generateBreadcrumbLinks function after adding the other page's missing links & title?

@harshrajeevsingh
Copy link
Contributor Author

@Bonapara Should we implement this not only in settings but everywhere in the app ?

CleanShot.2024-10-18.at.19.02.25.mp4
Don't we already do this?

@Bonapara I don't think so

Screenshot from 2024-10-19 19-53-19

@Bonapara
Copy link
Member

@lucasbordeau
Copy link
Contributor

@harshrajeevsingh modules/error-handlers seems like the right place ?

@harshrajeevsingh
Copy link
Contributor Author

@Bonapara Do we need that view bar, too? I think it's better to throw errors for that whole container. If any error occurs in viewBar, too, it will show the default GenericErrorFallback. @lucasbordeau wdyt?

Screenshot from 2024-10-22 00-43-45

@Bonapara
Copy link
Member

Hi @harshrajeevsingh, no we do not need the view bar, especially if it's a page error and not a table error

@harshrajeevsingh
Copy link
Contributor Author

@lucasbordeau what should be passed in header of both RecordIndexError & RecordShowError fallback and how?
For now, I just gave a temporary title.

Screenshot from 2024-10-23 00-45-43

@charlesBochet
Copy link
Member

/award 150

Copy link

oss-gg bot commented Oct 31, 2024

Awarding harshrajeevsingh: 150 points 🕹️ Well done! Check out your new contribution on oss.gg/harshrajeevsingh

@lucasbordeau
Copy link
Contributor

@harshrajeevsingh Let's try to keep the breadcrumb as it was before the error occurs, and then make sure the new white background is on every error page. We don't need to spend too much time on this.

@harshrajeevsingh
Copy link
Contributor Author

harshrajeevsingh commented Nov 1, 2024

@lucasbordeau Sorry, I didn’t quite understand. Are you asking me to remove the whole breadcrumbs part and just use a white container for every page with no headings or titles?

Like this?

Screenshot from 2024-10-23 00-10-06

@lucasbordeau
Copy link
Contributor

Yes please, also remove the breadcrumb computing part in your code, we'll see that later, thank you.

@lucasbordeau lucasbordeau enabled auto-merge (squash) November 4, 2024 16:46
@lucasbordeau lucasbordeau merged commit 8e82b08 into twentyhq:main Nov 4, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Settings Error Layout: Add White Container and Breadcrumb
4 participants