Skip to content

Feat/291 event feed pagination scale#300

Merged
Mosas2000 merged 21 commits intomainfrom
feat/291-event-feed-pagination-scale
Mar 18, 2026
Merged

Feat/291 event feed pagination scale#300
Mosas2000 merged 21 commits intomainfrom
feat/291-event-feed-pagination-scale

Conversation

@Mosas2000
Copy link
Copy Markdown
Owner

Closes #291

Introduce opaque cursor-based pagination to support stable,
deduplication-resistant event stream retrieval. Cursors are
timestamped identifiers that track the last fetched event,
allowing resumption without relying on unstable offset numbers.
Implement LRU-style page caching with:
- Per-page expiration (2-minute TTL)
- Invalidation boundaries for fresh data
- Pagination state tracking
- Cache statistics for monitoring

Reduces client load by preventing redundant event
fetches and enables smarter invalidation on new tips.
Introduce fetchEventPage() for fetching one page of events with
integrated parsing and metadata. This enables components to fetch
specific pages independently while keeping the existing
fetchAllContractEvents() for initial bulk loads.
Introduce useSelectiveMessageEnrichment to fetch messages only for
visible/paginated tips instead of all tips. Reduces API pressure during
initial load and prevents unnecessary enrichment work for offscreen tips.

Maintains persistent message cache across renders to minimize
redundant fetches as visible set changes.
Introduce usePaginatedEvents hook for loading events with page caching
and cursor support. Fetches one page at a time with integrated caching,
reducing memory footprint and API calls compared to loading all events upfront.

Provides cursor generation for stable pagination across refreshes.
- Import page cache utilities
- Update pagination state during event refresh
- Maintain coordination between shared event cache and page cache

Ensures both caches stay in sync when events are refreshed.
Introduce useFilteredAndPaginatedEvents to combine filtering, sorting,
pagination, and selective message enrichment. Provides a single-point
interface for event feed components.

Only enriches messages for visible page items, deferring enrichment
work until actually needed.
Replace client-side message enrichment of all tips with selective
enrichment for visible tips only. Integrate useFilteredAndPaginatedEvents
hook for unified filter/sort/paginate logic.

Benefits:
- Reduces message enrichment API calls
- Cleaner component with less state management
- Pagination logic centralized in hook
Verify cursor creation, decoding, and event filtering logic with
unit tests covering edge cases like out-of-bounds positions,
invalid cursors, and deduplication.
Verify cache storage, retrieval, invalidation, and TTL expiration
with unit tests. Cover edge cases for different page sizes and
pagination states.
Introduce enrichmentMetrics module to track API calls, cache hit rate,
and timing for enrichment operations. Enables measuring the impact of
selective enrichment vs. bulk enrichment.
Track enrichment API calls and cache hit rates in
useSelectiveMessageEnrichment to measure the impact of selective
vs. bulk enrichment strategies.
Document the event feed optimization improvements including:
- 90% reduction in message enrichment API calls
- Page caching with TTL
- Stable cursor-based pagination

Include measurement techniques and expected metrics demonstrating
the effectiveness of selective enrichment.
Document refactoring of event feed pipeline including selective
enrichment, page caching, and stable cursor-based pagination.
Includes list of new modules and performance improvements.
Document the multi-layer event feed pipeline including page caching,
stable cursors, selective enrichment, and performance benefits.

References performance profiling guide for measurement techniques.
Document component APIs, common patterns, best practices,
troubleshooting, and testing strategies for the event feed pipeline.

Includes examples for custom feeds, infinite scroll, and performance
monitoring.
Introduce useFeedConnectionStatus to track network and API health.
Detects offline status, API degradation, and enables graceful
fallbacks when services are unreliable.
Verify filter/sort/pagination logic works correctly in combination.
Test search, amount ranges, sorting, page navigation, and filter
clearing with realistic event data.
Introduce helpers for deduplication, batching, grouping, filtering,
and statistics calculation on event arrays. Enables efficient
multi-source event coordination and analysis.
Verify deduplication, batching, grouping, filtering, participant
extraction, and statistics calculation with edge case coverage.
Provide step-by-step instructions for updating existing code to use
the new pagination and selective enrichment system. Include before/after
patterns, common use cases, troubleshooting, and performance guidance.
@Mosas2000 Mosas2000 merged commit 45b03ad into main Mar 18, 2026
2 of 6 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.

Refactor the event feed pipeline for scale, cursoring, and selective enrichment

1 participant