From 25a4041958efd9756666fca4c982f92f8abc847d Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins <matiss@mja.lv> Date: Fri, 20 Sep 2024 08:11:20 +0100 Subject: [PATCH] :bug: (reports) deleting custom report should remove it from the dashboard (#3469) --- .../components/reports/reports/CustomReportListCards.tsx | 7 +++++++ upcoming-release-notes/3469.md | 6 ++++++ 2 files changed, 13 insertions(+) create mode 100644 upcoming-release-notes/3469.md diff --git a/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx b/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx index a083b991d..a96c99415 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 000000000..a5ff4ae73 --- /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. -- GitLab