Skip to content

fix(frontend): clear request timeout on failed requests#481

Merged
utksh1 merged 2 commits into
utksh1:mainfrom
HitanshiThakar:fix/api-timeout-cleanup
Jun 4, 2026
Merged

fix(frontend): clear request timeout on failed requests#481
utksh1 merged 2 commits into
utksh1:mainfrom
HitanshiThakar:fix/api-timeout-cleanup

Conversation

@HitanshiThakar
Copy link
Copy Markdown
Contributor

Description

Moved request timeout cleanup in frontend/src/api.ts into a finally block so timers are cleared for all request paths, including rejected and aborted requests.

Also added focused unit tests covering:

rejected fetch requests
aborted requests

This preserves the existing abort behavior while ensuring timeout cleanup always occurs.

Related Issues

Closes #465

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

npm run test -- api.auth

Result:

15 tests passed

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

@HitanshiThakar HitanshiThakar force-pushed the fix/api-timeout-cleanup branch from 6ebd132 to 4302449 Compare June 2, 2026 19:56
@utksh1 utksh1 added level:beginner 20 pts difficulty label for small beginner-friendly PRs type:bug Bug fix work category bonus label type:testing Testing work category bonus label area:frontend Frontend React/UI work gssoc:approved Admin validation: approved for GSSoC scoring labels Jun 4, 2026
Copy link
Copy Markdown
Owner

@utksh1 utksh1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The request helper now clears the timeout in a finally block, and the rejection/abort cleanup paths are covered by focused frontend tests. CI is passing.

@utksh1 utksh1 merged commit 3f1f8ab into utksh1:main Jun 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Frontend React/UI work gssoc:approved Admin validation: approved for GSSoC scoring level:beginner 20 pts difficulty label for small beginner-friendly PRs type:bug Bug fix work category bonus label type:testing Testing work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] API request timeout should always clear its timer

2 participants