Skip to content

[PERFORMANCE / UX] : GitRank.jsx: sessionStorage token loss on tab duplication or browser restore causes silent GitHub API rate-limit exhaustion #85

@MayurKharat0390

Description

@MayurKharat0390

Describe the bug

❌ Describe the bug

On the GitRank Rating Engine page (/dashboard/gitrank), the charts and stats panels fetch user event logs and repository analytics from GitHub's REST API. To authorize these requests, the page attempts to retrieve the GitHub OAuth token from sessionStorage:

const token = sessionStorage.getItem(`gh_token_${user?.uid}`);
const headers = token ? { Authorization: `token ${token}` } : {};

### Steps to reproduce


---

### 3. Steps to reproduce
```markdown
### 🛠️ Steps to Reproduce
1. Log into RankerHub with GitHub and navigate to the **GitRank** page (`/dashboard/gitrank`).
2. Duplicate the active browser tab (Right-click tab -> Duplicate).
3. Open the Developer Tools console (`F12`) on the duplicated tab.
4. Refresh the page and observe the network requests to `https://api.github.com/users/{username}/events`.
5. **Observe the Bug:** The request is sent without any `Authorization` header. Navigating between pages a few times immediately triggers a `403 rate limit exceeded` block.

### Expected behavior

The application should robustly handle token loss:
1. **Fallback/Graceful Warning:** If `sessionStorage` is empty but the user is logged in, show a subtle "Authentication Expired" or "Re-sync GitHub Connection" notice on the sync panel.
2. **Re-authentication Prompt:** Provide a button to trigger a quick GitHub OAuth re-auth flow to restore the transient token in the current tab without fully logging the user out.

### Screenshots/Videos

_No response_

### System Information

Windows, Chrome, Node.js v20+, npm v10+

### Before submitting

- [x] I have read the [Contributing Guidelines](https://github.com/indresh404/RankerHub/blob/main/docs/CONTRIBUTING.md)
- [x] I have checked for duplicate issues.
- [x] This is a bug that can be reproduced consistently.

Metadata

Metadata

Labels

NSoC'26NSoC 2026bugSomething isn't workinggssoc26GirlScript Summer of Code 2026needs-triage

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions