[GH-ISSUE #5044] Tech Debt: Fix missing dependency array in SaveReportChoose.tsx useEffect hook #43806

Closed
opened 2026-04-26 04:33:07 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @coderabbitai[bot] on GitHub (May 22, 2025).
Original GitHub issue: https://github.com/actualbudget/actual/issues/5044

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). Original GitHub issue: https://github.com/actualbudget/actual/issues/5044 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 tech debtgood first issue labels 2026-04-26 04:33:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#43806