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
Closes #3354
  • Loading branch information
MatissJanis committed Sep 19, 2024
1 parent 5e12d40 commit 7525349
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 7525349

Please sign in to comment.