Fix: Implement filter and auth credentials persistence on page refresh (#291)#293
Fix: Implement filter and auth credentials persistence on page refresh (#291)#293surjeetkumar8006 wants to merge 4 commits into
Conversation
✅ Deploy Preview for github-spy ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds localStorage persistence to GitHub authentication state and tracker UI state (filters, pagination, tabs). Users' selections now survive page refreshes, resolving the filter loss bug reported in issue ChangeslocalStorage State Persistence
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🎉 Thank you @surjeetkumar8006 for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/hooks/useGitHubAuth.ts`:
- Around line 5-6: The hook useGitHubAuth is storing sensitive GitHub
credentials in localStorage via the state initializers for username and token
(the useState calls that read 'tracker_username' and 'tracker_token'), which is
insecure; replace this client-side persistence with a server-side session flow
where the PAT is never stored in browser storage and is instead kept in an
httpOnly cookie or backend session and accessed via authenticated API endpoints
from the frontend; if a backend session cannot be implemented immediately,
change the storage fallback to sessionStorage (read/write
'tracker_username'/'tracker_token' from sessionStorage) as a temporary
mitigation or implement client-side encryption before persisting, but prefer
updating the authentication flow in useGitHubAuth to delegate storage and token
refresh to the server.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: da78dd20-77df-4f11-86fd-cc0aa3ed58e1
📒 Files selected for processing (3)
src/hooks/useGitHubAuth.tssrc/pages/Tracker/Tracker.tsxtsconfig.app.json
|
Updated the PR based on review feedback:
All checks are now passing. |
Description
This PR resolves issue #291 by implementing
localStoragepersistence for the tracking dashboard filters and GitHub authentication credentials.Previously, refreshing the page would reset all selected filters and require the user to re-enter their GitHub username and Personal Access Token.
Changes Made:
src/pages/Tracker/Tracker.tsx: Initialized filter states (tab, page, issue/PR state filters, search queries, and dates) usinglocalStorage.getItemand added auseEffectto sync them.src/hooks/useGitHubAuth.ts: Ensured the GitHub username and Token are also stored and retrieved fromlocalStorageso users stay authenticated on reload.tsconfig.app.json: Removed an unsupported TypeScript compiler option to resolve VS Code syntax warnings.Related Issue
Fixes #291
Checklist
Summary by CodeRabbit