Skip to content

fix: load portfolio and market data correctly on first paint (#535)#536

Open
mikepappalardo wants to merge 1 commit into
nextfrom
fix/535-portfolio-market-data-load
Open

fix: load portfolio and market data correctly on first paint (#535)#536
mikepappalardo wants to merge 1 commit into
nextfrom
fix/535-portfolio-market-data-load

Conversation

@mikepappalardo

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes stale/incorrect portfolio and market values on initial load by orchestrating parallel user + market fetches, clearing state on wallet change, and POST-refreshing only markets where the user has positions
  • Speeds market loading with bulk GET /market-data/{network}, parallel fallback fetches, and app-mount market prefetch via React Query
  • Removes dangerous display fallbacks ($1 price, 1e18 index) and shows loading states instead of misleading zeros on the Markets tab

Closes #535

Test plan

  • Connect wallet on Portfolio — net worth, health, collateral, and borrow totals appear correctly without a manual browser refresh
  • Supply/borrow position rows populate with correct amounts after brief load (no wild USD values on first paint)
  • Switch wallet address — previous wallet data does not flash before new data loads
  • Open Markets tab — TVL/APY cells show loading spinners initially, not $0
  • Click Markets refresh — data updates even when clicked twice within 2 minutes
  • Disconnect/reconnect wallet — portfolio reloads automatically with accurate figures

Made with Cursor

Orchestrate parallel user and market fetches, prefetch markets on app mount,
use bulk API for fetchAllMarkets, and gate position rows on real indices and
prices instead of stale fallbacks.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mikepappalardo mikepappalardo requested a review from temptemp3 June 17, 2026 03:37
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.

fix: Portfolio & Market Data Loads with Stale/Incorrect Values Before Refresh

1 participant