opensanctions / opensanctions/poliloom

Stale politician data after browser back navigation

Open Beginner friendly
#153 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

gui
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

  1. Visit a politician page
  2. Add a source
  3. Navigate to the stats page
  4. Press browser back button
  5. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.