Skip to content

feat: add per-widget refresh controls with stale-data indicators#677

Merged
Junirezz merged 2 commits into
Junirezz:mainfrom
temi-Dee:feat/issue-546-per-widget-refresh-controls
Jun 1, 2026
Merged

feat: add per-widget refresh controls with stale-data indicators#677
Junirezz merged 2 commits into
Junirezz:mainfrom
temi-Dee:feat/issue-546-per-widget-refresh-controls

Conversation

@temi-Dee
Copy link
Copy Markdown
Contributor

@temi-Dee temi-Dee commented Jun 1, 2026

Summary

Implements per-widget refresh controls with stale-data indicators across the frontend, resolving #546.

Changes

VaultDashboard stats panel (TVL/APY widget)

  • Added RefreshControl + stale indicator below the stats header
  • Wired to VaultContext.refresh via usePolling (30s interval, pauses on hidden/offline)
  • Stale indicator uses useStaleIndicator(lastUpdate) from VaultContext

Analytics page stats section

  • Added RefreshControl + stale indicator above the stats cards
  • Same polling/stale pattern as VaultDashboard

APYTrendChart

  • Added RefreshControl + stale indicator above the chart
  • Uses a local refreshFn that updates a lastUpdated timestamp (data is static/mock)
  • Polls every 60s

Bug fixes

  • Fixed useStaleIndicator: cached snapshot result to prevent useSyncExternalStore infinite re-render loop (new object reference on every getSnapshot call)
  • Memoized lastUpdate in VaultContext to prevent unnecessary re-renders

Note: VaultPerformanceChart already had RefreshControl integrated prior to this PR.

Testing

Test suite: 8 failed files / 56 failed tests before and after — no regressions introduced. All pre-existing failures are unrelated to this change (missing QueryClientProvider/PreferencesProvider in test wrappers).

Closes #546

temi-Dee added 2 commits June 1, 2026 00:13
Junirezz#574 Documentation: Add environment variable reference table for backend and frontend
#closes 574
…irezz#546)

- Add RefreshControl + stale indicator to VaultDashboard stats panel
  (TVL/APY widget) using usePolling(refresh, 30s) from VaultContext
- Add RefreshControl + stale indicator to Analytics page stats section
  using the same VaultContext refresh/lastUpdate
- Add RefreshControl + stale indicator to APYTrendChart with a local
  refresh function that updates the lastUpdated timestamp
- Fix useStaleIndicator: cache snapshot result to prevent useSyncExternalStore
  infinite re-render loop when getSnapshot returns new object references
- Memoize lastUpdate in VaultContext to prevent unnecessary re-renders

Closes Junirezz#546
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@temi-Dee 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

@Junirezz Junirezz merged commit a04d391 into Junirezz:main Jun 1, 2026
7 of 13 checks passed
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.

Frontend: Add per-widget refresh controls with stale-data indicators

2 participants