fix: Use hybrid approach socket-rest to fetch recent activity #24212
+680
−16
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.



Description
There was an inconsistency with the recent activity on the PerpsActivityView, where we weren't displaying recent activity outside of a given time constraint. So, if you previously traded an asset, but it was a long time ago, we wouldn't show that data to the user.
Changelog
CHANGELOG entry: Add hybrid REST/websocket approach to building recent activity
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TAT-2221
Manual testing steps
Replicate the bug from the ticket by going to a asset pair that was traded a long time ago, but not within the previous week. We should still see the previous trades even if it's outside of this window.
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Introduces a new market-specific fills hook that merges WebSocket and REST data, and updates the trades list to use it for accurate, real-time plus historical recent trades.
usePerpsMarketFillshook: combinesusePerpsLiveFills(WS) with RESTgetOrderFills, filters bysymbol, dedupes byorderId-timestamp, sorts desc, exposesrefresh,isRefreshing, andisInitialLoadingusePerpsLiveFillswithusePerpsMarketFillsinPerpsMarketTradesListand simplify local filtering/sorting; keep limit viaPERPS_CONSTANTS.RECENT_ACTIVITY_LIMITusePerpsMarketFillsfromhooks/index.tsusePerpsMarketFills.test.tscovering filtering, merging precedence, sorting, REST fetch/error handling, refresh behavior, and throttle forwardingWritten by Cursor Bugbot for commit 5c9855e. This will update automatically on new commits. Configure here.