Skip to content

A local-first personal finance app

:bug: (reports) deleting custom report should remove it from the dashboard (#3469)

Matiss Janis Aboltins25a4041958ef
diff --git a/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx b/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx
index a083b991dc..a96c99415e 100644
--- a/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx
+++ b/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx
@@ -9,6 +9,7 @@ import { type CustomReportEntity } from 'loot-core/types/models/reports';
import { useAccounts } from '../../../hooks/useAccounts';
import { useCategories } from '../../../hooks/useCategories';
+import { useFeatureFlag } from '../../../hooks/useFeatureFlag';
import { usePayees } from '../../../hooks/usePayees';
import { useSyncedPref } from '../../../hooks/useSyncedPref';
import { SvgExclamationSolid } from '../../../icons/v1';
@@ -35,9 +36,15 @@ export function CustomReportListCards({
report,
onRemove,
}: CustomReportListCardsProps) {
+ const isDashboardsFeatureEnabled = useFeatureFlag('dashboards');
+
// It's possible for a dashboard to reference a non-existing
// custom report
if (!report) {
+ if (!isDashboardsFeatureEnabled) {
+ return null;
+ }
+
return (
<MissingReportCard isEditing={isEditing} onRemove={onRemove}>
This custom report has been deleted.
diff --git a/upcoming-release-notes/3469.md b/upcoming-release-notes/3469.md
new file mode 100644
index 0000000000..a5ff4ae73e
--- /dev/null
+++ b/upcoming-release-notes/3469.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [MatissJanis]
+---
+
+Reports - deleting custom reports should remove the widget from the dashboard.