Skip to content

Fix agenda builder revalidating in an endless loop - #21

Merged
JakeGinnivan merged 1 commit into
mainfrom
fix/agenda-revalidate-loop
Oct 19, 2026
Merged

JakeGinnivan merged 1 commit into
mainfrom
fix/agenda-revalidate-loop

Conversation

@andrewabest

@andrewabest andrewabest commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Opening the agenda builder (/admin/voting/agenda/:runId) fetches its .data endpoint several times a second from the moment it renders, until the tab crashes.

The effect that revalidates once the save queue drains depended on revalidator, which React Router recreates on every state change. Each revalidation finishing put it back to idle with a new identity, re-running the effect and kicking off the next one. The state === 'idle' guard only blocked re-entry during a fetch, not after.

Fix: track the previous isSaving in a ref and only revalidate on the saving → idle transition. The 10s poll is unaffected.

🤖 Generated with Claude. 💁‍♂️ Reviewed and refined by Andrew.

The post-save revalidate effect depended on `revalidator`, which is a new
object on every state change. Each revalidation finishing returned it to
idle and re-ran the effect, so the page fetched its .data endlessly from
the moment it rendered until the tab crashed. Only revalidate on the
saving -> idle transition.

Co-Authored-By: Claude <noreply@octopus.com>
@JakeGinnivan
JakeGinnivan merged commit 25d412c into main Oct 19, 2026
3 checks passed
@JakeGinnivan
JakeGinnivan deleted the fix/agenda-revalidate-loop branch October 19, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants