Skip to content

A local-first personal finance app

:bug: (dashboards) add back spending report if dashboards feature is not enabled (#3323)

Matiss Janis Aboltinsae608f0cb839
diff --git a/packages/desktop-client/src/components/reports/Overview.tsx b/packages/desktop-client/src/components/reports/Overview.tsx
index 0587f6dc7d..faec350ce6 100644
--- a/packages/desktop-client/src/components/reports/Overview.tsx
+++ b/packages/desktop-client/src/components/reports/Overview.tsx
@@ -96,7 +96,26 @@ export function Overview() {
const isDashboardsFeatureEnabled = useFeatureFlag('dashboards');
const spendingReportFeatureFlag = useFeatureFlag('spendingReport');
- const layout = useWidgetLayout(widgets);
+ const baseLayout = useWidgetLayout(widgets);
+ const layout =
+ spendingReportFeatureFlag &&
+ !isDashboardsFeatureEnabled &&
+ !baseLayout.find(({ type }) => type === 'spending-card')
+ ? [
+ ...baseLayout,
+ {
+ i: 'spending',
+ type: 'spending-card' as const,
+ x: 0,
+ y: Math.max(...baseLayout.map(({ y }) => y), 0) + 2,
+ w: 4,
+ h: 2,
+ minW: 3,
+ minH: 2,
+ meta: null,
+ },
+ ]
+ : baseLayout;
const closeNotifications = () => {
dispatch(removeNotification('import'));
diff --git a/upcoming-release-notes/3323.md b/upcoming-release-notes/3323.md
new file mode 100644
index 0000000000..8807a5a099
--- /dev/null
+++ b/upcoming-release-notes/3323.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [MatissJanis]
+---
+
+Dashboards: add back spending report if dashboards are not enabled