Skip to content

fix: wait for lend market data hydration#596

Merged
Seranged merged 1 commit into
developmentfrom
fix/lend-apy-hydration
Jun 22, 2026
Merged

fix: wait for lend market data hydration#596
Seranged merged 1 commit into
developmentfrom
fix/lend-apy-hydration

Conversation

@Seranged

@Seranged Seranged commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix intermittent lend detail APY displays caused by resolving the page vault before reward and intrinsic APY enrichment finishes.
  • Align the lend deeplink readiness gate with the market-data hydration signal used by direct market routes.

Changes

  • Add a small wait helper for isMarketDataResolved on the lend detail page.
  • Wait for market data before capturing EVault or securitize vault instances from the registry, including the existing registry fast path.

Test plan

  • npm run typecheck
  • npx eslint pages/lend/[vault]/index.vue
  • Smoke-tested /lend/0xD8ec5b4917FeF9058545e7D1dc2aC17F1D26305D?network=143 on local port 3001 and confirmed Supply APY settled at 7.80% across reloads

Summary by CodeRabbit

  • Bug Fixes
    • Improved vault loading reliability by ensuring market data is fully resolved before fetching vault information.

@railway-app

railway-app Bot commented Jun 19, 2026

Copy link
Copy Markdown

🚅 Deployed to the euler-lite-pr-596 environment in euler-lite

Service Status Web Updated (UTC)
dev-build ✅ Success (View Logs) Web Jun 19, 2026 at 4:19 pm

@railway-app railway-app Bot temporarily deployed to euler-lite / euler-lite-pr-596 June 19, 2026 16:18 Destroyed
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

An error occurred during the review process. Please try again later.

📝 Walkthrough

Walkthrough

In pages/lend/[vault]/index.vue, isMarketDataResolved is added to the useVaults() destructuring. A waitForMarketData() helper is introduced that resolves immediately if market data is ready, or races a watcher against a 10-second timeout. This helper is awaited before both the securitize vault fetch and the EVault fetch in the page's async load flow.

Changes

Market Data Gate for Vault Loading

Layer / File(s) Summary
waitForMarketData helper and vault-load integration
pages/lend/[vault]/index.vue
Adds isMarketDataResolved to useVaults() destructuring, defines waitForMarketData() using Promise.race with a 10-second timeout, and inserts await waitForMarketData() before both the securitize vault and EVault fetch paths in the async load sequence.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • euler-xyz/euler-lite#541: Applies the same pattern of awaiting isMarketDataResolved from useVaults() before running vault/USD-related computations to prevent stale pre-hydration values.
  • euler-xyz/euler-lite#553: Changes the async selection flow to wait on isMarketDataResolved before consuming market-data-derived fields in borrow vault pair logic.

Suggested reviewers

  • kasperpawlowski

Poem

🐇 Hop, hop, I wait at the gate,
No vault shall load before data is straight.
A watcher I race with ten seconds of time,
Then forward we leap — all data's in line.
The market must settle before we proceed,
A patient small rabbit is all that you need! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: adding a wait mechanism for market data hydration on the lend page before vault data is fetched.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lend-apy-hydration

Comment @coderabbitai help to get the list of available commands and usage tips.

@LeonardEulerXYZ LeonardEulerXYZ left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head c4e3c95dd706b626f285187f13e92d66221c15a6.

Verdict: COMMENT — no blocking findings found.

What changed:

  • pages/lend/[vault]/index.vue now waits for isMarketDataResolved before taking the one-time lend-detail vault instance from the registry/direct fetch path.
  • This aligns the lend detail route with the existing market-data readiness gate used by market grouping/borrow-pair resolution, so reward/intrinsic APY enrichment is less likely to be missed on direct navigation or reload.

Validation performed:

  • git diff --check origin/development...HEAD
  • npx eslint 'pages/lend/[vault]/index.vue'
  • npm run typecheck
  • npm run build
  • Browser visual smoke on the Railway PR preview route /lend/0xD8ec5b4917FeF9058545e7D1dc2aC17F1D26305D?network=143 using headed Chromium:
    • desktop viewport: 4 reloads returned HTTP 200, real app title/content, and stable Supply APY 7.81%; no material page/console errors
    • mobile viewport: 4 reloads returned HTTP 200 and stable Supply APY 7.81%; expanded Vault information rendered the overview and the same APY; no material page/console errors

Risk assessment:

  • UX affected: lend detail deeplinks/direct reloads, especially vaults whose APY depends on delayed reward/intrinsic market-data enrichment.
  • Safety/transaction impact: no transaction construction, signing, allowance, or wallet boundary code changed. Wallet/signing smoke was not run.
  • Main residual caveat: the new wait has a bounded 10s timeout, matching the existing borrow-pair pattern. If enrichment is still unresolved after that, the page intentionally proceeds rather than hanging; this preserves availability but cannot guarantee APY enrichment under a genuinely stalled data load.

Scalability / maintainability hygiene pass:

  • I checked for the PR #587-style “one-off local fix” problem. This patch adds a small local wait helper in the lend detail page, and the same wait/timeout shape already exists in useVaults().getBorrowVaultPair.
  • For this one-file bug fix I do not see that as blocking: the helper is local to a page-specific direct-route capture point and the duplicate existing pattern is still small.
  • If a third direct-route surface needs the same readiness gate, I would extract the wait into useVaults or a small shared utility and add focused tests around the timeout/proceed behavior. Not necessary for this PR as-is.

Smoke coverage: browser visual smoke + mobile smoke on the PR preview; no wallet/signing smoke.

Screenshots: captured during local validation, but not attached here because the available GitHub/Gist CLI path does not support uploading binary PNGs directly in this environment, and I did not want to create a brittle non-rendering artifact on a public PR.

@Seranged Seranged merged commit 2de1384 into development Jun 22, 2026
2 checks passed
@Seranged Seranged deleted the fix/lend-apy-hydration branch June 22, 2026 10:10
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.

3 participants