Add a pausable auto-refresh interval to the event log
Description
src/app/events/page.tsx fetches GET /api/v1/events?limit=100 exactly once on mount, so an operator watching for new pair/webhook activity must reload the page to see fresh events. This issue adds an opt-in polling refresh with a visible pause/resume toggle, mirroring the visibility-aware pattern used for stats but exposed as an explicit control here.
Requirements and context
- Repository scope: StableRoute-Org/Stableroute-frontend only.
- Add a "Live" toggle that, when on, re-fetches the event list on a fixed interval (e.g. 10s) and merges/replaces the list; when off, stops the interval entirely.
- Pause polling automatically when
document.visibilityState === "hidden" and resume on visible, so backgrounded tabs do not poll.
- Show a last-updated indicator using
src/components/TimeAgo.tsx and keep the existing role="alert" error region and chronological order.
- Clean up the interval and the
visibilitychange listener on unmount; no new dependencies.
Suggested execution
- Fork the repo and create a branch
git checkout -b feature/events-02-live-refresh
- Implement changes
- Test and commit
Test and commit
- Run
npm run lint, npm test, and npm run build.
- Cover edge cases: toggle on/off, hidden-tab pause, visible resume, and fetch error keeps last list.
- Include the full
npm test output in the PR description.
Example commit message
feat: add pausable visibility-aware auto-refresh to event log
Guidelines
- Minimum 95 percent test coverage for impacted modules.
- Clear, reviewer-focused documentation.
- Timeframe: 96 hours.
Community & contribution rewards
- 💬 Join the StableRoute community on Discord for questions, reviews, and faster merges: https://discord.gg/37aCpusvx
- ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Add a pausable auto-refresh interval to the event log
Description
src/app/events/page.tsxfetchesGET /api/v1/events?limit=100exactly once on mount, so an operator watching for new pair/webhook activity must reload the page to see fresh events. This issue adds an opt-in polling refresh with a visible pause/resume toggle, mirroring the visibility-aware pattern used for stats but exposed as an explicit control here.Requirements and context
document.visibilityState === "hidden"and resume on visible, so backgrounded tabs do not poll.src/components/TimeAgo.tsxand keep the existingrole="alert"error region and chronological order.visibilitychangelistener on unmount; no new dependencies.Suggested execution
git checkout -b feature/events-02-live-refreshsrc/app/events/page.tsxusingsrc/components/TimeAgo.tsx.src/app/events/page.test.tsxwith fake timers and a mockedvisibilitychange.README.md.Test and commit
npm run lint,npm test, andnpm run build.npm testoutput in the PR description.Example commit message
feat: add pausable visibility-aware auto-refresh to event logGuidelines
Community & contribution rewards