Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #291