Skip to content

Commit 8a10669

Browse files
committed
Add offline message to query loading error
1 parent 1693d88 commit 8a10669

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/app/components/elements/Book.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ export const Book = ({match: {params: {bookId}}}: BookProps) => {
5050
<SidebarLayout>
5151
<ShowLoadingQuery
5252
query={bookIndexPageQuery}
53-
defaultErrorTitle="Unable to load book contents."
53+
defaultErrorTitle="Unable to load book contents"
5454
thenRender={(definedBookIndexPage) => {
5555
return <>
5656
<BookSidebar book={definedBookIndexPage} urlBookId={bookId} pageId={pageId} />
5757
<MainContent className="mt-4">
5858
{pageId
5959
? <ShowLoadingQuery
6060
query={bookDetailPageQuery}
61-
defaultErrorTitle="Unable to load book page."
61+
defaultErrorTitle="Unable to load book page"
6262
thenRender={(bookDetailPage) => <BookPage page={bookDetailPage} />}
6363
/>
6464
: <>

src/app/components/handlers/ShowLoadingQuery.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ const loadingPlaceholder = <div className="w-100 text-center pb-2">
1515
export const DefaultQueryError = ({error, title}: {error?: FetchBaseQueryError | SerializedError, title: string}) => {
1616
const errorDetails = getRTKQueryErrorMessage(error);
1717
return <Alert color={"warning"} className={"my-2"}>
18-
{title ?? "Error fetching data from server"}: {errorDetails.message}
18+
{title ?? "Error fetching data from server"}: {window.navigator.onLine ? errorDetails.message : "You appear to be offline."}
1919
{errorDetails.status ? <><br/>Status code: {errorDetails.status}</> : ""}
2020
<br/>
21-
You may want to refresh the page, or <a href={`mailto:${WEBMASTER_EMAIL}`}>email</a> us if
21+
You may want to{!window.navigator.onLine && " check your internet connection,"} refresh the page, or <a href={`mailto:${WEBMASTER_EMAIL}`}>email</a> us if
2222
this continues to happen.
2323
Please include in your email the name and email associated with this{" "}
2424
{SITE_TITLE} account, alongside the details of the error given above.

0 commit comments

Comments
 (0)