Skip to content

Conversation

@gambinish
Copy link
Contributor

@gambinish gambinish commented Dec 19, 2025

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

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

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.

  • Add usePerpsMarketFills hook: combines usePerpsLiveFills (WS) with REST getOrderFills, filters by symbol, dedupes by orderId-timestamp, sorts desc, exposes refresh, isRefreshing, and isInitialLoading
  • Replace usePerpsLiveFills with usePerpsMarketFills in PerpsMarketTradesList and simplify local filtering/sorting; keep limit via PERPS_CONSTANTS.RECENT_ACTIVITY_LIMIT
  • Export usePerpsMarketFills from hooks/index.ts
  • Add comprehensive tests in usePerpsMarketFills.test.ts covering filtering, merging precedence, sorting, REST fetch/error handling, refresh behavior, and throttle forwarding

Written by Cursor Bugbot for commit 5c9855e. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-perps Perps team label Dec 19, 2025
@gambinish gambinish marked this pull request as ready for review December 20, 2025 00:02
@gambinish gambinish requested a review from a team as a code owner December 20, 2025 00:02
@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps
  • Risk Level: low
  • AI Confidence: 95%
click to see 🤖 AI reasoning details

The changes are entirely contained within the Perps (Perpetuals trading) feature directory (app/components/UI/Perps/). The PR introduces:

  1. A new hook usePerpsMarketFills.ts that combines WebSocket and REST API data for fetching market-specific fills
  2. Comprehensive unit tests for the new hook (535 lines of tests)
  3. An update to PerpsMarketTradesList.tsx to use the new hook instead of usePerpsLiveFills, simplifying the component logic
  4. Export of the new hook in the hooks index file

The changes are well-isolated:

  • No core modules, controllers, or Engine changes
  • No changes to critical paths or shared infrastructure
  • The new hook is only used by the PerpsMarketTradesList component
  • The component is only used within the Perps feature views
  • Comprehensive unit tests are included

This is a standard feature enhancement within the Perpetuals trading domain, making SmokePerps the only necessary test tag to verify the changes.

View GitHub Actions results

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.28%. Comparing base (adcb2c2) to head (5c9855e).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24212      +/-   ##
==========================================
- Coverage   79.28%   79.28%   -0.01%     
==========================================
  Files        4057     4058       +1     
  Lines      106862   106974     +112     
  Branches    21666    21705      +39     
==========================================
+ Hits        84728    84814      +86     
- Misses      16220    16236      +16     
- Partials     5914     5924      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 5, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants