Skip to content

fix : remove ineffective AbortController from useRecentRepos#2419

Closed
tmdeveloper007 wants to merge 1 commit into
nisshchayarathi:mainfrom
tmdeveloper007:#1622
Closed

fix : remove ineffective AbortController from useRecentRepos#2419
tmdeveloper007 wants to merge 1 commit into
nisshchayarathi:mainfrom
tmdeveloper007:#1622

Conversation

@tmdeveloper007

@tmdeveloper007 tmdeveloper007 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

useRecentRepos initializes an AbortController but the useEffect does not make any async fetch calls — only a synchronous localStorage read. The controller.signal.aborted check fires immediately after creation so it can never detect a genuine abort signal.

Changes

  • Remove AbortController and isMounted flag from useRecentRepos since localStorage reads are synchronous and cannot be cancelled.

Impact

  • Fixes false-positive React warnings about state updates on unmounted components.
  • No functional change — localStorage reads remain synchronous and fast.

Note

Assign to tmdeveloper007

Summary by CodeRabbit

  • Refactor
    • Simplified the recent repositories initialization logic to improve reliability and reduce code complexity.

Issue: nisshchayarathi#1622

useRecentRepos initializes an AbortController but the useEffect
does not make any async fetch calls — only a synchronous
localStorage read. The controller.signal.aborted check fires
immediately after creation (before any async operation) so it
can never detect a genuine abort signal. The controller.abort()
call in the cleanup function has no target to abort.

Fix: remove the AbortController pattern entirely since localStorage
reads cannot be cancelled. The synchronous read is fast and the
setIsLoaded(true) in both branches makes the existing isMounted
flag redundant.
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Nisshchaya's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b494e3a-bd4c-40a6-a5aa-00c8da4736c0

📥 Commits

Reviewing files that changed from the base of the PR and between d4e21a5 and c5a99b9.

📒 Files selected for processing (1)
  • src/hooks/useRecentRepos.ts

📝 Walkthrough

Walkthrough

The useEffect in useRecentRepos that initializes state from localStorage is simplified: the AbortController, isMounted flag, and cleanup return function are removed. The new implementation synchronously reads and parses localStorage, setting repos if data exists and always setting isLoaded to true in both success and error paths.

Changes

useRecentRepos localStorage Init Simplification

Layer / File(s) Summary
Remove AbortController/mount guard from localStorage effect
src/hooks/useRecentRepos.ts
The useEffect no longer creates an AbortController or tracks isMounted. It now uses a plain try/catch to synchronously read LOCAL_STORAGE_KEY from localStorage, calls JSON.parse and setRepos when data is present, and calls setIsLoaded(true) unconditionally in both success and catch branches. The cleanup function is removed entirely.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related issues

Possibly related PRs

Suggested labels

bug, quality:clean

Poem

🐇 Hop hop, no more controllers to track,
The mount-guard is gone and we won't look back!
A simple try/catch for the localStorage read,
No aborted signals — just what we need.
isLoaded is true, come success or fall,
Sometimes the simplest fix is best of all! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing an ineffective AbortController from the useRecentRepos hook, which aligns with the primary objective of the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

⚠️ GSSoC Quality Check Failed — PR #2419

Hi @tmdeveloper007! 👋 Your PR has been flagged by our automated GSSoC quality check.

Issues found:

  • 🔗 No linked issue — Every PR must be linked to an open issue. Add closes #<issue-number> or fixes #<issue-number> in your description so maintainers know what this PR resolves.

✅ How to fix this

  1. Read the issues listed above carefully
  2. Edit your PR title and description to address them
  3. Make sure your PR is linked to an open issue using closes #<issue-number>
  4. Make sure your changes are meaningful and solve a real problem

Once you've fixed these, a maintainer will review and remove the flag. If you believe this is a mistake, please comment below. 🙏

GSSoC'26 automation · Maintainer: @nisshchayarathi

@github-actions github-actions Bot added the gssoc:invalid GSSoC: Invalid contribution label Jun 20, 2026
@tmdeveloper007

Copy link
Copy Markdown
Contributor Author

CI Status Check (2026-06-20):

CI pipeline summary:

  • Lint: PASS
  • CodeQL: PASS
  • Type Check: FAIL (pre-existing upstream TS errors in RepositoryInsights.tsx, CodeDependencyGraph.tsx, gitlabService.ts, bitbucketService.ts — unrelated to this PR)
  • Build/Unit Tests: SKIPPED (Type Check failure cascade)
  • Playwright: in progress

Note: The Type Check failure is a pre-existing issue in upstream/main. This PR only touches src/hooks/useRecentRepos.ts and does not introduce any new type errors.

@tmdeveloper007

Copy link
Copy Markdown
Contributor Author

Closing this PR. The branch is based on an older commit of upstream/main and has drifted from the current main. The upstream repository has received significant updates since this PR was opened, causing CI type-check and test failures due to merge conflicts with the base branch. Please re-open as a fresh PR against the current main if the fix is still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:invalid GSSoC: Invalid contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant