Tech Debt: Fix missing dependency array in SaveReportChoose.tsx useEffect hook #2147

Closed
opened 2026-02-28 20:04:43 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @coderabbitai[bot] on GitHub (May 22, 2025).

Originally assigned to: @joel-jeremy on GitHub.

Description

The useEffect hook in SaveReportChoose.tsx (lines 23-27) is missing a dependency array, causing it to run after every render. This can lead to unnecessary re-renders and potential performance issues.

Current code

useEffect(() => {
  if (inputRef.current) {
    inputRef.current.focus();
  }
});

Suggested fix

useEffect(() => {
  if (inputRef.current) {
    inputRef.current.focus();
  }
}, []);

Context

This issue was identified during review of PR #4955 (https://github.com/actualbudget/actual/pull/4955#discussion_r2101632830) but was decided to be fixed in a separate PR.

Expected outcome

The useEffect hook should only run once on component mount, not after every render.

Originally created by @coderabbitai[bot] on GitHub (May 22, 2025). Originally assigned to: @joel-jeremy on GitHub. ## Description The useEffect hook in SaveReportChoose.tsx (lines 23-27) is missing a dependency array, causing it to run after every render. This can lead to unnecessary re-renders and potential performance issues. ## Current code ```typescript useEffect(() => { if (inputRef.current) { inputRef.current.focus(); } }); ``` ## Suggested fix ```typescript useEffect(() => { if (inputRef.current) { inputRef.current.focus(); } }, []); ``` ## Context This issue was identified during review of PR #4955 (https://github.com/actualbudget/actual/pull/4955#discussion_r2101632830) but was decided to be fixed in a separate PR. ## Expected outcome The useEffect hook should only run once on component mount, not after every render.
GiteaMirror added the good first issuetech debt labels 2026-02-28 20:04:43 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#2147