Skip to content

hotfix: positions query#516

Merged
antoncoding merged 3 commits into
masterfrom
fix/mainnet
May 8, 2026
Merged

hotfix: positions query#516
antoncoding merged 3 commits into
masterfrom
fix/mainnet

Conversation

@antoncoding
Copy link
Copy Markdown
Owner

@antoncoding antoncoding commented May 8, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added persistent loading toast notification that displays while calculating feed metrics.
  • Improvements

    • Stats now display "Calculating" state with contextual detail messages during metadata loading, providing clearer feedback during data refresh operations.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
monarch Ready Ready Preview, Comment May 8, 2026 1:59pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Review Change Stack

Warning

Rate limit exceeded

@antoncoding has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 20 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 43f689ac-1449-4381-b874-7fb100c2c0c7

📥 Commits

Reviewing files that changed from the base of the PR and between cc05676 and b9ae0d9.

📒 Files selected for processing (2)
  • src/hooks/queries/useMarketsQuery.ts
  • src/hooks/useUserPositions.ts
📝 Walkthrough

Walkthrough

PR adds loading UI feedback for feed metrics calculation, replaces inline placeholder with persistent toast notification, refactors position market identification to use chain-aware keys with blacklist filtering and missing metadata hydration, and documents related regression constraint.

Changes

Feed Detail Loading State

Layer / File(s) Summary
Component Props
src/features/feed-detail/components/feed-sections.tsx
FeedHero adds optional isStatsLoading?: boolean prop.
Stats Display
src/features/feed-detail/components/feed-sections.tsx
StatTile values show Calculating when loading; detail text switches to loading-appropriate messages.
Loading State Computation
src/features/feed-detail/feed-view.tsx
Derive isMetadataLoading from route support and async states (oracle, markets, usd enrichment).
Toast Notification
src/features/feed-detail/feed-view.tsx
Show persistent "Calculating feed metrics" toast while loading; dismiss on completion or cleanup.
Render Wiring
src/features/feed-detail/feed-view.tsx
Remove inline loading placeholder; pass isMetadataLoading to FeedHero; preserve error messaging.

Position Market Metadata Hydration

Layer / File(s) Summary
Regression Rule
AGENTS.md
Document constraint: portfolio/position flows must hydrate unknown-token metadata before deciding renderability.
Dependencies
src/hooks/useUserPositions.ts
Import monarch-market fetch, morpho/subgraph helpers, blacklist store, and chain-aware identity key utility.
Blacklist Access
src/hooks/useUserPositions.ts
Retrieve isBlacklisted from store for hydration filtering.
Market Metadata Hydration
src/hooks/useUserPositions.ts
Build chain-keyed market map, identify missing registry entries, filter blacklisted, fetch details from Monarch.
Identity Key Application
src/hooks/useUserPositions.ts
Use chain-aware keys for oracle lookup, snapshot/price storage, and final merge-step data retrieval.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

bug

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'hotfix: positions query' is vague and doesn't clearly convey what changed. It refers to 'positions query' but the PR modifies multiple areas including feed stats loading, regression documentation, and market hydration logic. Clarify the title to reflect the main change, such as 'fix: hydrate missing market metadata in user positions' or 'fix: add loading state for feed metrics calculation'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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/mainnet

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot added the bug Something isn't working label May 8, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/hooks/useUserPositions.ts (1)

258-264: ⚡ Quick win

Failed hydrations are silent.

When fetchMonarchMarket rejects or returns null for a user-discovered market, that position quietly disappears at the !market gate (line 305). A console.warn with the chainId/marketUniqueKey would make this regression class observable in the wild.

Optional log nudge
       for (const result of missingMarketResults) {
         if (result.status !== 'fulfilled' || !result.value) {
+          if (result.status === 'rejected') {
+            console.warn('[Positions] Failed to hydrate user-owned market', result.reason);
+          }
           continue;
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hooks/useUserPositions.ts` around lines 258 - 264, When iterating
missingMarketResults in useUserPositions, failed or null fetches are currently
ignored; update the loop that handles missingMarketResults (the block that
checks result.status !== 'fulfilled' || !result.value) to log a warning via
console.warn including the chain id and market unique key so failures are
observable. Use the same identity fields used in getMarketIdentityKey
(result.value?.morphoBlue?.chain?.id and result.value?.uniqueKey) and include
the promise result status and any error information available, but still
continue to skip adding to marketDataMap.set for failed/null results.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/hooks/useUserPositions.ts`:
- Around line 258-264: When iterating missingMarketResults in useUserPositions,
failed or null fetches are currently ignored; update the loop that handles
missingMarketResults (the block that checks result.status !== 'fulfilled' ||
!result.value) to log a warning via console.warn including the chain id and
market unique key so failures are observable. Use the same identity fields used
in getMarketIdentityKey (result.value?.morphoBlue?.chain?.id and
result.value?.uniqueKey) and include the promise result status and any error
information available, but still continue to skip adding to marketDataMap.set
for failed/null results.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fad88bf0-1645-41c3-8d25-5ad9aac3ded0

📥 Commits

Reviewing files that changed from the base of the PR and between 090f84a and cc05676.

📒 Files selected for processing (4)
  • AGENTS.md
  • src/features/feed-detail/components/feed-sections.tsx
  • src/features/feed-detail/feed-view.tsx
  • src/hooks/useUserPositions.ts

@antoncoding antoncoding merged commit a35f45a into master May 8, 2026
4 checks passed
@antoncoding antoncoding deleted the fix/mainnet branch May 8, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant