-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into release/v0.4.0
- Loading branch information
Showing
10 changed files
with
339 additions
and
16 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
NEXT_PUBLIC_API_URL=http://localhost:3000/api/v1 | ||
NEXT_PUBLIC_STORAGE_URL=http://localhost:3000/api/assets | ||
NEXT_PUBLIC_MIXPANEL_TOKEN=f2e8a71ab2bde33ebf346c5abf6ba9fa | ||
NEXT_PUBLIC_MIXPANEL_TOKEN=f2e8a71ab2bde33ebf346c5abf6ba9fa | ||
NEXT_PUBLIC_ROLLBAR_ACCESS_TOKEN=0df0bee895044430880278e2b2a5b2d2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"use client"; | ||
import React, { useEffect, useState } from "react"; | ||
import { Button } from "./ui/Button"; | ||
import { usePathname } from "next/navigation"; | ||
|
||
interface ErrorFallbackProps { | ||
error: Error | null; | ||
resetError: () => void; | ||
} | ||
|
||
interface ErrorFallbackBaseProps extends ErrorFallbackProps { | ||
textColor: string; | ||
} | ||
|
||
// Fallback UI component displayed on error | ||
const ErrorFallbackBase = ({ | ||
error, | ||
resetError, | ||
textColor, | ||
}: ErrorFallbackBaseProps) => { | ||
const pathname = usePathname(); | ||
const [initialPathname, setInitialPathname] = useState<string | null>(null); | ||
|
||
useEffect(() => { | ||
if (initialPathname === null) { | ||
setInitialPathname(pathname); | ||
} else if (pathname !== initialPathname && error) { | ||
resetError(); | ||
} | ||
}, [pathname, initialPathname, error, resetError]); | ||
|
||
return ( | ||
<div className={`p-8 text-center ${textColor}`}> | ||
<h1>Oops! Something went wrong.</h1> | ||
<p>{error?.message || "We're working on fixing this issue."}</p> | ||
<Button onClick={resetError} className="mt-4"> | ||
Try Again | ||
</Button> | ||
</div> | ||
); | ||
}; | ||
|
||
export const GlobalErrorFallback = (props: ErrorFallbackProps) => ( | ||
<ErrorFallbackBase {...props} textColor="text-white" /> | ||
); | ||
|
||
export const ViewErrorFallback = (props: ErrorFallbackProps) => ( | ||
<ErrorFallbackBase {...props} textColor="text-black" /> | ||
); |
Oops, something went wrong.