fix: improve booking page error boundary + remove dynamic imports from Booker (#20560)

* improve booking page error boundary + remove dynamic imports from Booker

* safer

* fix

* fix test

* change name
This commit is contained in:
Benny Joo authored and GitHub committed 2025-04-07 09:51:14 +03:00
1 parent d158a1e007
commit 5c7d7579ee
5 files changed
+28 -18

No files matched your search

@@ -7,8 +7,11 @@ import { ErrorPage } from "./error-page";
export default function BookingPageErrorBoundary({ children }: { children: React.ReactNode }) {
return (
<ErrorBoundary
fallbackRender={({ error }) => <ErrorPage error={error} message={`${error}`} displayDebug={true} />}
fallbackRender={({ error, resetErrorBoundary }) => (
<ErrorPage reset={resetErrorBoundary} error={error} message={`${error}`} displayDebug={true} />
)}
onError={(error, info) => {
console.error(error);
captureReactException(error, info);
}}>
{children}
+7 -3
View File
@@ -12,6 +12,7 @@ type Props = {
/** Display debugging information */
displayDebug?: boolean;
children?: never;
reset?: () => void;
};
const defaultProps = {
@@ -53,7 +54,10 @@ const ErrorDebugPanel: React.FC<{ error: Props["error"]; children?: never }> = (
export const ErrorPage: React.FC<Props> = (props) => {
const { message, statusCode, error, displayDebug } = { ...defaultProps, ...props };
const handleReset = () => {
window.location.reload();
props.reset?.();
};
return (
<>
<div className="bg-subtle flex h-screen">
@@ -77,8 +81,8 @@ export const ErrorPage: React.FC<Props> = (props) => {
</div>
<Button href="mailto:[email protected]">Contact Support</Button>
<Button color="secondary" href="javascript:history.back()" className="ml-2">
Go back
<Button color="secondary" className="ml-2" onClick={handleReset}>
Try again
</Button>
</div>
</div>