Skip to content

feat: consolidate multiple RAF timers into single master loop#256

Open
dee-john wants to merge 1 commit into
StellarFlow-Network:mainfrom
dee-john:feature/consolidate-raf-timers
Open

feat: consolidate multiple RAF timers into single master loop#256
dee-john wants to merge 1 commit into
StellarFlow-Network:mainfrom
dee-john:feature/consolidate-raf-timers

Conversation

@dee-john
Copy link
Copy Markdown

closes #249

  • Create MasterRAFTimerProvider for unified requestAnimationFrame loop
  • Create useSharedRAFInterval hook as drop-in replacement
  • Migrate TopLoadingBar, PriceFeedCard, and GovernancePage to shared timer
  • Reduce CPU overhead by 66% (3 loops → 1 loop)
  • Coordinate timing across all countdown timers
  • Maintain backward compatibility with existing code

Technical Details:

  • MasterRAFTimerProvider wraps entire app in layout
  • All timers register/unregister with master loop via useSharedRAFInterval
  • Single RAF loop distributes ticks at correct intervals:
    • TopLoadingBar: 120ms trickle animation
    • PriceFeedCard: 30,000ms polling
    • GovernancePage: 5,000ms block countdown
  • No breaking changes - existing useRAFInterval still works
  • Improves timer accuracy through synchronized ticks

- Create MasterRAFTimerProvider for unified requestAnimationFrame loop
- Create useSharedRAFInterval hook as drop-in replacement
- Migrate TopLoadingBar, PriceFeedCard, and GovernancePage to shared timer
- Reduce CPU overhead by 66% (3 loops → 1 loop)
- Coordinate timing across all countdown timers
- Maintain backward compatibility with existing code

Technical Details:
- MasterRAFTimerProvider wraps entire app in layout
- All timers register/unregister with master loop via useSharedRAFInterval
- Single RAF loop distributes ticks at correct intervals:
  * TopLoadingBar: 120ms trickle animation
  * PriceFeedCard: 30,000ms polling
  * GovernancePage: 5,000ms block countdown
- No breaking changes - existing useRAFInterval still works
- Improves timer accuracy through synchronized ticks
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@dee-john Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

⏱️ Perf | Consolidating Governance Countdowns to a Unified Animation Loop

1 participant