Skip to content
Snippets Groups Projects
Unverified Commit ff70c654 authored by Neil's avatar Neil Committed by GitHub
Browse files

Custom Reports Error Catch (#2492)

* Error Catch

* notes

* fixes
parent 586a2696
No related branches found
No related tags found
No related merge requests found
import React, { createRef, useMemo, useState } from 'react'; import React, { createRef, useMemo, useState } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { send, sendCatch } from 'loot-core/platform/client/fetch/index'; import { send, sendCatch } from 'loot-core/platform/client/fetch/index';
import { type CustomReportEntity } from 'loot-core/types/models/reports'; import { type CustomReportEntity } from 'loot-core/types/models/reports';
import { styles } from '../../../style'; import { styles } from '../../../style/index';
import { theme } from '../../../style/theme'; import { theme } from '../../../style/theme';
import { Block } from '../../common/Block'; import { Block } from '../../common/Block';
import { Menu } from '../../common/Menu'; import { Menu } from '../../common/Menu';
...@@ -56,6 +57,19 @@ function index(data: CustomReportEntity[]): { [key: string]: boolean }[] { ...@@ -56,6 +57,19 @@ function index(data: CustomReportEntity[]): { [key: string]: boolean }[] {
}, []); }, []);
} }
function ErrorFallback() {
return (
<>
<div>
<br />
</div>
<Text style={{ ...styles.mediumText, color: theme.errorText }}>
There was a problem loading your report
</Text>
</>
);
}
export function CustomReportListCards({ export function CustomReportListCards({
reports, reports,
}: { }: {
...@@ -193,18 +207,20 @@ export function CustomReportListCards({ ...@@ -193,18 +207,20 @@ export function CustomReportListCards({
</View> </View>
{report.data ? ( {report.data ? (
<ChooseGraph <ErrorBoundary FallbackComponent={ErrorFallback}>
startDate={report.startDate} <ChooseGraph
endDate={report.endDate} startDate={report.startDate}
data={report.data} endDate={report.endDate}
mode={report.mode} data={report.data}
graphType={report.graphType} mode={report.mode}
balanceType={report.balanceType} graphType={report.graphType}
groupBy={report.groupBy} balanceType={report.balanceType}
interval={report.interval} groupBy={report.groupBy}
compact={true} interval={report.interval}
style={{ height: 'auto', flex: 1 }} compact={true}
/> style={{ height: 'auto', flex: 1 }}
/>
</ErrorBoundary>
) : ( ) : (
<LoadingIndicator /> <LoadingIndicator />
)} )}
......
---
category: Bugfix
authors: [carkom]
---
Error catch for reports overview page.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment