Skip to content

A local-first personal finance app

[AI] Fix Age of Money report widget title not saving correctly (#8320)

youngcwe353bc579707
diff --git a/packages/desktop-client/src/components/reports/reports/AgeOfMoney.tsx b/packages/desktop-client/src/components/reports/reports/AgeOfMoney.tsx
index 9849e90616..96d9993b63 100644
--- a/packages/desktop-client/src/components/reports/reports/AgeOfMoney.tsx
+++ b/packages/desktop-client/src/components/reports/reports/AgeOfMoney.tsx
@@ -44,6 +44,7 @@ import { useRuleConditionFilters } from '#hooks/useRuleConditionFilters';
import { useSyncedPref } from '#hooks/useSyncedPref';
import { addNotification } from '#notifications/notificationsSlice';
import { useDispatch } from '#redux';
+import { useUpdateDashboardWidgetMutation } from '#reports/mutations';
import { getAgeColor } from './AgeOfMoneyCard';
@@ -178,23 +179,27 @@ function AgeOfMoneyInner({ widget }: AgeOfMoneyInnerProps) {
[],
);
+ const updateDashboardWidgetMutation = useUpdateDashboardWidgetMutation();
+
const onSaveWidget = useCallback(async () => {
if (!widget) {
throw new Error('No widget that could be saved.');
}
- await send('dashboard-update-widget', {
- id: widget.id,
- meta: {
- ...(widget.meta ?? {}),
- conditions,
- conditionsOp,
- timeFrame: {
- start,
- end,
- mode,
+ await updateDashboardWidgetMutation.mutateAsync({
+ widget: {
+ id: widget.id,
+ meta: {
+ ...(widget.meta ?? {}),
+ conditions,
+ conditionsOp,
+ timeFrame: {
+ start,
+ end,
+ mode,
+ },
+ granularity,
},
- granularity,
},
});
dispatch(
@@ -207,6 +212,7 @@ function AgeOfMoneyInner({ widget }: AgeOfMoneyInnerProps) {
);
}, [
widget,
+ updateDashboardWidgetMutation,
conditions,
conditionsOp,
start,
@@ -228,15 +234,17 @@ function AgeOfMoneyInner({ widget }: AgeOfMoneyInnerProps) {
}
const name = newName || t('Age of Money');
- await send('dashboard-update-widget', {
- id: widget.id,
- meta: {
- ...(widget.meta ?? {}),
- name,
+ await updateDashboardWidgetMutation.mutateAsync({
+ widget: {
+ id: widget.id,
+ meta: {
+ ...(widget.meta ?? {}),
+ name,
+ },
},
});
},
- [widget, t],
+ [widget, updateDashboardWidgetMutation, t],
);
if (!allMonths || !data) {
diff --git a/upcoming-release-notes/fix-age-of-money-title-save.md b/upcoming-release-notes/fix-age-of-money-title-save.md
new file mode 100644
index 0000000000..6fe65730a6
--- /dev/null
+++ b/upcoming-release-notes/fix-age-of-money-title-save.md
@@ -0,0 +1,6 @@
+---
+category: Bugfixes
+authors: [youngcw]
+---
+
+Fix Age of Money report widget title not saving correctly.