Skip to content

feat: IndexedDB local store for staking logs (#143)#213

Open
DammyAji wants to merge 1 commit into
StellarFlow-Network:mainfrom
DammyAji:feat/143-indexeddb-staking-logs
Open

feat: IndexedDB local store for staking logs (#143)#213
DammyAji wants to merge 1 commit into
StellarFlow-Network:mainfrom
DammyAji:feat/143-indexeddb-staking-logs

Conversation

@DammyAji
Copy link
Copy Markdown

Summary

Resolves #143 — persistent IndexedDB integration pipeline for staking/slashing logs.

Changes

src/lib/stakingLogsDb.ts

  • Added 7-day TTL eviction on DB open via IDBKeyRange.upperBound cursor sweep
  • Added getLogsPaginated(page, pageSize, eventTypeFilter) — avoids full table scans on every render
  • Added getDbStats() — per-event-type counts + oldest/newest timestamps

src/app/hooks/useStakingLogsStore.ts

  • Exposes page, dbStats, currentPage, pageSize, eventTypeFilter state
  • Exposes setCurrentPage, setPageSize, setEventTypeFilter setters
  • Stats and page refresh after every mutation

src/app/components/StakingLogsPanel.tsx (new)

  • Live sync indicator (pulses on new log arrival)
  • Event-type filter tabs (All / Stake / Slash / Reward / Unstake)
  • Per-type stat counters bar
  • Paginated log table with colour-coded badges, amounts, tx hashes, relative timestamps
  • Rows-per-page selector (5 / 10 / 20)
  • Loading skeleton + empty state
  • Footer: "Stored in browser IndexedDB · No server round-trips"

src/app/staking/page.tsx

  • Integrated StakingLogsPanel below the node table

Technical approach

Large slashing log sets are now cached in the browser's IndexedDB store. Repeat page views read from the local store instead of hitting the backend, eliminating redundant DB node load. Stale entries are evicted automatically after 7 days.

- Add TTL-based eviction (7-day) to stakingLogsDb
- Add getLogsPaginated() and getDbStats() to DB layer
- Enhance useStakingLogsStore with pagination, stats, and filter state
- Add StakingLogsPanel component with live sync indicator, event filters,
  paginated log table, and per-type stats
- Integrate StakingLogsPanel into staking page
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 28, 2026

@DammyAji 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 | IndexDB Local Store for Staking Logs

1 participant