Skip to content

Fix invalid hook call in handleSyncEverything#8460

Merged
iHiD merged 2 commits into
mainfrom
fix/8452
Feb 9, 2026
Merged

Fix invalid hook call in handleSyncEverything#8460
iHiD merged 2 commits into
mainfrom
fix/8452

Conversation

@iHiD
Copy link
Copy Markdown
Member

@iHiD iHiD commented Feb 9, 2026

Closes #8452

Summary

  • The handleSyncEverything function was a standalone exported function that called useAppTranslation() (a React hook), violating the Rules of Hooks — it was invoked from onClick handlers, outside the component render cycle
  • Moved the sync-everything logic into useCallback hooks inside ManualSyncSection and JustConnectedModal, matching the pattern already used by handleSyncSingleTrack
  • Removed the standalone exported function that was the source of the error

Test plan

  • yarn test passes (160/160 suites, 1550/1550 tests)
  • Manual: navigate to Settings > GitHub Syncer when connected, click "Backup Everything" — should show success/error toast without React hook errors
  • Manual: verify the JustConnectedModal sync button also works without errors

🤖 Generated with Claude Code

The handleSyncEverything function was a standalone exported function that
called useAppTranslation (a React hook), violating the Rules of Hooks.
It was called from onClick handlers, outside the component render cycle.

Move the logic into useCallback hooks inside the respective components,
matching the pattern already used by handleSyncSingleTrack.

Closes #8452

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@iHiD iHiD requested a review from dem4ron as a code owner February 9, 2026 10:23
@iHiD iHiD merged commit 2485ded into main Feb 9, 2026
40 checks passed
@iHiD iHiD deleted the fix/8452 branch February 9, 2026 12:34
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.

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

2 participants