opensanctions / opensanctions/poliloom
Stale politician data after browser back navigation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 22
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Bug
After adding a source to a politician, navigating to the stats page, then pressing the browser back button, the newly added source is not visible. A full page refresh is required to see it.
Root Cause
The politician page (src/app/(app)/politician/[qid]/page.tsx) is a server component that fetches data via fetchWithAuth() without specifying cache: 'no-store'. In Next.js 16, server-side fetch() defaults to caching the response.
When a source is added, refetchPolitician() in PoliticianEvaluation.tsx updates client-side React state, but does not invalidate the Next.js server component cache. On back navigation, Next.js restores the page from its stale server cache rather than re-fetching.
Steps to Reproduce
- Visit a politician page
- Add a source
- Navigate to the stats page
- Press browser back button
- Observe the source is missing — refresh to see it
Suggested Fix
Add cache: 'no-store' to the fetch call in page.tsx, or use revalidatePath()/revalidateTag() after mutations.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/app/(app)/politician/[qid]/page.tsx and inspect the fetchWithAuth() call, then review refetchPolitician() in PoliticianEvaluation.tsx to understand the update path. Reproduce the listed navigation sequence and verify that a newly added source remains visible after browser back navigation without a full refresh.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100