Skip to content

Commit

Permalink
🐛 (reports) deleting custom report should remove it from the dashboard (
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis authored Sep 20, 2024
1 parent e6bf6da commit 25a4041
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3469.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MatissJanis]
---

Reports - deleting custom reports should remove the widget from the dashboard.

0 comments on commit 25a4041

Please sign in to comment.