fix(rewards): remove client cache for Ondo portfolio positions#29868
Conversation
|
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. |
Disables the client-side cache (sets TTL to 0 in wrapWithCache) for the user-facing campaign endpoints whose freshness was visibly lagging behind activity: - ONDO_CAMPAIGN_PORTFOLIO_POSITION_CACHE_THRESHOLD_MS - ONDO_CAMPAIGN_LEADERBOARD_POSITION_CACHE_THRESHOLD_MS - ONDO_CAMPAIGN_ACTIVITY_CACHE_THRESHOLD_MS - PERPS_TRADING_CAMPAIGN_LEADERBOARD_POSITION_CACHE_THRESHOLD_MS Selectors continue to read from the mirrored Redux state, which is still written on every fetch. Per agreement on Slack for today's RC. Co-authored-by: VGR-GIT <vangulckrik@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
c9444c4 to
e77be61
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Impact analysis:
Tag selection rationale:
The changes are scoped to cache TTL constants and don't affect Engine initialization, other controllers, or navigation infrastructure, so broader test coverage is not warranted. Performance Test Selection: |
|



Description
After a rebalance, the Ondo positions list could remain stale for up to 60 seconds while the activity list (which is not cached on the client) showed the up-to-date trade. Both views read the same upstream data, so the divergence was purely a client-side cache artifact in
RewardsController.getOndoCampaignPortfolioPosition.This PR sets
ONDO_CAMPAIGN_PORTFOLIO_POSITION_CACHE_THRESHOLD_MSto0, which makeswrapWithCachealways treat the entry as stale and fetch fresh from the API. The mirrored Redux state (state.ondoCampaignPortfolio[…]) is still written on each fetch, so selectors continue to render the latest snapshot — only the staleness window is removed.Agreed on the approach with @jonathan.deyoung and @christian.montoya in this Slack thread; flagged as a quick win for today's RC. Jonathan's call: low-risk because traffic to this endpoint is low and hits read-only servers, and the longer-term fix (timestamp-aligning positions and activity, à la S1) is parked as Perps follow-up work.
Changelog
CHANGELOG entry: null
Related issues
Fixes: N/A — driven by Slack thread linked above.
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
Note
Medium Risk
Disables several short-lived client caches, increasing request frequency for authenticated rewards endpoints; main risk is performance/network impact and potential rate-limiting, not data integrity.
Overview
Removes the client-side TTL for several rewards “live snapshot” reads by setting their cache thresholds to
0, forcing fresh API fetches while still mirroring responses into controller state for selectors.This applies to Ondo leaderboard position, Ondo portfolio position, Ondo first-page activity, and Perps trading leaderboard position, and updates unit tests and generated action-type docs to reflect the new always-fresh behavior (including re-fetching even when a recent not-found sentinel exists).
Reviewed by Cursor Bugbot for commit e77be61. Bugbot is set up for automated code reviews on this repo. Configure here.