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.
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 viafetchWithAuth()without specifyingcache: 'no-store'. In Next.js 16, server-sidefetch()defaults to caching the response.When a source is added,
refetchPolitician()inPoliticianEvaluation.tsxupdates 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
Suggested Fix
Add
cache: 'no-store'to the fetch call inpage.tsx, or userevalidatePath()/revalidateTag()after mutations.