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

126 add error handling mechanism to the UI #518

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
2 changes: 1 addition & 1 deletion src/sections/error-page/ErrorPage.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
flex-direction: column;
align-items: center;
justify-content: center;
min-height: $main-container-available-height;
min-height: var(--error-min-height);
}

.middle-search-cta-wrapper {
Expand Down
5 changes: 5 additions & 0 deletions src/sections/error-page/ErrorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export function ErrorPage() {
useErrorLogger(error)
const theme = useTheme()

const header = document.querySelector('nav')
const footer = document.querySelector('footer')
const newMinHeight = header && footer ? '$main-container-available-height' : '100vh'
document.documentElement.style.setProperty('--error-min-height', newMinHeight)

Copy link
Contributor

@g-saracca g-saracca Oct 9, 2024

Choose a reason for hiding this comment

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

I would avoid running natives javascript dom selectors to find elements by their tag name or even by a class name, these might change and might not even be the only ones you find.

Take a look at this, is from my lazy imports PR, see this tsx file and this scss one.

So then you only need to pass that prop to the ErrorPage on the root layout path object.


  {
    path: '/',
    element: <Layout />,
    errorElement: <ErrorPage fullViewport />,
    children: [
    ...rest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I'll follow the example. Thank you!

return (
<section className={styles['section-wrapper']}>
<div className={styles['middle-search-cta-wrapper']}>
Expand Down
Loading