AOSSIE-Org / AOSSIE-Org/OrgExplorer
[BUG]: Cache key ignores auth state, causing stale contributor data after adding PAT
- Ngôn ngữ chính
- JavaScript
- Star
- 34
- Fork
- 92
- Merge trung bình
- 8 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 12
Mô tả
### Bug Description
`fetchWithCache()` in `src/services/github.js` caches responses using only the URL as key, ignoring `pat`. Since `fetchContributors` uses `maxPages = pat ? 10 : 1`, page=1 has the same URL whether authenticated or not. Once page=1 is cached without a PAT, adding a PAT later silently returns the old cached page=1 instead of re-fetching with auth. Affects `fetchOrg`, `fetchRepos`, `fetchContributors`, `fetchIssues`, `fetchPulls`.
### Steps to Reproduce
1. Without a PAT, explore an org (e.g. AOSSIE-Org) — caches page=1 contributors for each repo.
2. Add a PAT in Settings, Save.
3. Explore the same org again.
4. In DevTools → Network, filter by a repo already explored in step 1 (e.g. "Website").
5. page=1 shows no new request (served from cache); only page=2, page=3... appear as fresh requests.
### Logs and Screenshots
async function fetchWithCache(url, pat) {
const cached = await cacheGet(url) // <-- pat ignored here
if (cached) return cached
...
const data = await res.json()
cacheSet(url, data) // <-- pat ignored here too
return data
}
### Environment Details
_No response_
### Impact
Critical - Application is unusable
### Code of Conduct
- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates
Hướng dẫn đóng góp
Hướng nghiên cứu
Start in src/services/github.js at fetchWithCache(), then trace its use from fetchOrg, fetchRepos, fetchContributors, fetchIssues, and fetchPulls. Reproduce the unauthenticated-then-authenticated sequence described in the issue and inspect cacheGet/cacheSet behavior. Done means page=1 is fetched again after a PAT is added instead of being served from the unauthenticated cache.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- github, javascript
- Lĩnh vực
- api, backend
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 84/100