Skip to content

fix(frontend): resolve ESLint react-hooks/exhaustive-deps warning in ReportViewer#32

Merged
AlanFokCo merged 1 commit into
mainfrom
copilot/fix-failed-action
May 23, 2026
Merged

fix(frontend): resolve ESLint react-hooks/exhaustive-deps warning in ReportViewer#32
AlanFokCo merged 1 commit into
mainfrom
copilot/fix-failed-action

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 23, 2026

ESLint with --max-warnings 0 was failing CI because getChartHeight — a function that closes over isPhone/isTablet state — was used inside a useEffect but absent from its dependency array.

Changes

  • ReportViewer.tsx: Convert getChartHeight from a plain inline function to useCallback with [isPhone, isTablet] deps; add it to the chart-building useEffect dep array
// Before
function getChartHeight(base: number): number { ... }
useEffect(() => { ... }, [data]);

// After
const getChartHeight = useCallback((base: number): number => { ... }, [isPhone, isTablet]);
useEffect(() => { ... }, [data, getChartHeight]);

…tive-deps ESLint rule

Agent-Logs-Url: https://github.com/AlanFokCo/EasyQuant/sessions/a45a508d-804a-4c2d-a525-3bbac838c8ac

Co-authored-by: AlanFokCo <49893220+AlanFokCo@users.noreply.github.com>
@AlanFokCo AlanFokCo marked this pull request as ready for review May 23, 2026 04:57
@AlanFokCo AlanFokCo merged commit 6699a15 into main May 23, 2026
@AlanFokCo AlanFokCo deleted the copilot/fix-failed-action branch May 23, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants