Skip to content

fix: react-hooks/exhaustive-deps in frontend directory #346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ta1m1kam
Copy link

@ta1m1kam ta1m1kam commented Jul 25, 2025

Overview

This PR fixes ESLint errors across the frontend codebase, with a focus on React hooks dependencies and circular
reference issues. The main refactor targets the useNormalizedConversation hook, while also updating ESLint
configuration for better code quality.

Problems Addressed

  1. Circular dependencies in hooks: The useNormalizedConversation hook had complex circular dependencies between
    callbacks
  2. Missing React hooks dependencies: Multiple useCallback and useEffect hooks had incorrect dependency arrays
  3. ESLint configuration: Missing explicit rule for react-hooks/exhaustive-deps
  4. Code maintainability: Unnecessary use of refs to work around circular dependencies

Changes

1. ESLint Configuration Updates

  • Added explicit react-hooks/exhaustive-deps rule configuration in .eslintrc.json
  • Set the rule to "error" level to catch dependency issues during development

2. Major Refactor: useNormalizedConversation Hook

  • Eliminated circular dependencies: Moved scheduleReconnect as a local function inside establishSSEConnection
  • Removed unnecessary refs: Deleted establishSSEConnectionRef and related ref management code
  • Consolidated logic: Merged createSSEConnection functionality into a single callback
  • Fixed all dependency warnings: Properly declared all dependencies in useCallback hooks

3. Minor Fixes Across Components

  • Updated dependency arrays in various components to satisfy ESLint rules
  • Added missing dependencies where needed
  • Used ESLint disable comments sparingly where circular dependencies were intentional

…r dependencies

  - Remove unnecessary ref usage (establishSSEConnectionRef)
  - Move scheduleReconnect as a local function inside establishSSEConnection
  - Eliminate circular dependencies between callback functions
  - Fix all ESLint errors related to React hooks deps
  - Maintain identical logic and behavior
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.

1 participant