diff --git a/packages/desktop-client/src/components/reports/SaveReportChoose.tsx b/packages/desktop-client/src/components/reports/SaveReportChoose.tsx index 43f396176f9..42b1b73b070 100644 --- a/packages/desktop-client/src/components/reports/SaveReportChoose.tsx +++ b/packages/desktop-client/src/components/reports/SaveReportChoose.tsx @@ -1,4 +1,5 @@ import React, { createRef, useEffect, useState } from 'react'; +import { Form } from 'react-aria-components'; import { theme } from '../../style/theme'; import { Button } from '../common/Button2'; @@ -24,7 +25,18 @@ export function SaveReportChoose({ onApply }: SaveReportChooseProps) { return ( <> -
+ { + e.preventDefault(); + + if (!value) { + setErr('Invalid report entered'); + return; + } + + onApply(value); + }} + > Choose Report @@ -47,21 +59,11 @@ export function SaveReportChoose({ onApply }: SaveReportChooseProps) { style={{ marginTop: 15 }} > - - + {err !== '' ? ( {err} diff --git a/packages/desktop-client/src/components/reports/SaveReportName.tsx b/packages/desktop-client/src/components/reports/SaveReportName.tsx index fd3f2c5e5ab..74d4b458a43 100644 --- a/packages/desktop-client/src/components/reports/SaveReportName.tsx +++ b/packages/desktop-client/src/components/reports/SaveReportName.tsx @@ -1,4 +1,5 @@ import React, { type RefObject, useEffect } from 'react'; +import { Form } from 'react-aria-components'; import { type CustomReportEntity } from 'loot-core/types/models/reports'; @@ -44,7 +45,15 @@ export function SaveReportName({ return ( <> {menuItem !== 'update-report' && ( -
+ { + e.preventDefault(); + onAddUpdate({ + menuChoice: menuItem ?? undefined, + reportData: report ?? undefined, + }); + }} + > - -
+ )} {err !== '' ? ( diff --git a/upcoming-release-notes/3462.md b/upcoming-release-notes/3462.md new file mode 100644 index 00000000000..541a072ce91 --- /dev/null +++ b/upcoming-release-notes/3462.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [joel-jeremy] +--- + +Fix save report forms submit handler so that it doesn't trigger a reload of an entire page on submit.