Skip to content

A local-first personal finance app

fix: add missing dependency array to useEffect in SaveReportChoose.tsx (#5044) (#5111)

Matiss Janis Aboltinsb22d712b4f42
diff --git a/packages/desktop-client/src/components/reports/SaveReportChoose.tsx b/packages/desktop-client/src/components/reports/SaveReportChoose.tsx
index 446a169693..6b1a8f4bc1 100644
--- a/packages/desktop-client/src/components/reports/SaveReportChoose.tsx
+++ b/packages/desktop-client/src/components/reports/SaveReportChoose.tsx
@@ -1,4 +1,4 @@
-import React, { createRef, useEffect, useState } from 'react';
+import React, { useRef, useEffect, useState } from 'react';
import { Form } from 'react-aria-components';
import { useTranslation } from 'react-i18next';
@@ -15,7 +15,7 @@ type SaveReportChooseProps = {
};
export function SaveReportChoose({ onApply }: SaveReportChooseProps) {
- const inputRef = createRef<HTMLInputElement>();
+ const inputRef = useRef<HTMLInputElement>(null);
const [err, setErr] = useState('');
const [value, setValue] = useState('');
const { t } = useTranslation();
@@ -24,7 +24,7 @@ export function SaveReportChoose({ onApply }: SaveReportChooseProps) {
if (inputRef.current) {
inputRef.current.focus();
}
- });
+ }, []);
return (
<>
diff --git a/upcoming-release-notes/5111.md b/upcoming-release-notes/5111.md
new file mode 100644
index 0000000000..1e61a02bd3
--- /dev/null
+++ b/upcoming-release-notes/5111.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [MatissJanis]
+---
+
+Add missing dependency array to useEffect in SaveReportChoose