-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into TASK-387-sort-and-rendering-fix-for-dropd…
…own-shifts
- Loading branch information
Showing
10 changed files
with
193 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/components/app-error-boundary/app-error-boundary.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
import React, { ReactNode, useCallback, useState } from "react"; | ||
import AppErrorModal from "../common-components/modal/app-error-modal/app-error.modal.component"; | ||
import * as Sentry from "@sentry/react"; | ||
|
||
interface AppErrorBoundaryOptions { | ||
children: ReactNode; | ||
} | ||
|
||
export function AppErrorBoundary(props: AppErrorBoundaryOptions): JSX.Element { | ||
const [open, setIsOpen] = useState(false); | ||
const fallback = useCallback( | ||
({ resetError }): JSX.Element => ( | ||
<AppErrorModal onClick={resetError} open={open} setOpen={setIsOpen} /> | ||
), | ||
[open, setIsOpen] | ||
); | ||
|
||
const onError = useCallback((): void => { | ||
setIsOpen(true); | ||
}, [setIsOpen]); | ||
|
||
return <Sentry.ErrorBoundary fallback={fallback} onError={onError} {...props} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.