Skip to content

chore: fix liquidated flag#472

Merged
antoncoding merged 1 commit intomasterfrom
fix/indicators
Mar 26, 2026
Merged

chore: fix liquidated flag#472
antoncoding merged 1 commit intomasterfrom
fix/indicators

Conversation

@antoncoding
Copy link
Copy Markdown
Owner

@antoncoding antoncoding commented Mar 26, 2026

Summary by CodeRabbit

  • New Features

    • Market tables now display a loading indicator for historical rate columns (24h, 7d, 30d rates) while enrichment data is being fetched.
    • Market liquidation history is now more resilient and protected against temporary service interruptions.
  • Bug Fixes

    • Historical rates now properly differentiate between "still loading" and "data unavailable" states, displaying "—" only when enrichment is confirmed unavailable.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 26, 2026

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

Project Deployment Actions Updated (UTC)
monarch Ready Ready Preview, Comment Mar 26, 2026 6:16am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

📝 Walkthrough

Walkthrough

Documentation adds two validation rules for liquidation history and historical rate loading signals. Market table rendering centralizes historical rate cell logic with a helper function. Metrics query hooks introduce a new liquidation presence check with fallback to handle unavailable data.

Changes

Cohort / File(s) Summary
Documentation
AGENTS.md
Added two validation rules: liquidation-history source integrity (item 57) and historical-rate loading signal integrity (item 58).
Market Table Rendering
src/features/markets/components/table/market-table-body.tsx
Added renderHistoricalRateCell() helper to centralize rendering of 24h/7d/30d rate columns; shows PulseLoader when enrichment is loading, when unavailable, or formatted value when available.
Metrics Query Hooks
src/hooks/queries/useMarketMetricsQuery.ts
Introduced useMarketLiquidationPresence hook backed by new GraphQL query; updated useEverLiquidated to consult precomputed flag first, then fallback to liquidation presence query when metrics are still loading.
Market Processing Hook
src/hooks/useProcessedMarkets.ts
Extended return value to include new isRateEnrichmentLoading boolean, computed from query loading/fetching states and enrichment data availability.

Sequence Diagram(s)

sequenceDiagram
    participant Comp as Market Table Component
    participant Hook as useEverLiquidated
    participant MetricsHook as useMarketMetricsMap
    participant LiqHook as useMarketLiquidationPresence
    participant API as GraphQL API

    Comp->>Hook: useEverLiquidated(chainId, uniqueKey)
    Hook->>MetricsHook: Check metricsMap for everLiquidated
    
    alt everLiquidated available
        MetricsHook->>Hook: Return precomputed flag
        Hook->>Comp: Boolean result
    else Metrics still loading or unavailable
        Hook->>LiqHook: useMarketLiquidationPresence(chainId, uniqueKey)
        LiqHook->>API: Query MARKET_LIQUIDATION_PRESENCE_QUERY
        API-->>LiqHook: Liquidation records found?
        LiqHook-->>Hook: hasLiquidationPresence boolean
        Hook->>Comp: everLiquidated || hasLiquidationPresence
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

ui

🚥 Pre-merge checks | ✅ 1 | ❌ 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 'chore: fix liquidated flag' is vague and doesn't clearly describe the actual changes. The PR adds validation rules, updates rate enrichment loading states, and modifies liquidation presence logic—far broader than just fixing a flag. Use a more descriptive title that captures the main changes, such as 'Add liquidation presence validation and historical rate loading indicators' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/indicators

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 ui User interface label Mar 26, 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/features/markets/components/table/market-table-body.tsx (1)

38-54: Clean helper function. Logic correctly implements the three-state pattern from validation rule 58.

Minor nit: color="#f45f2d" is hardcoded. Consider using a CSS variable or theme token if one exists for brand orange.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/features/markets/components/table/market-table-body.tsx` around lines 38
- 54, In renderHistoricalRateCell replace the hardcoded PulseLoader
color="#f45f2d" with the app's theme token or CSS variable (e.g. use
theme.colors.brandOrange or a CSS var like var(--brand-orange)) so the loader
uses the shared brand orange; update the PulseLoader prop to reference the token
(via styled/theme hook or inline var) in the renderHistoricalRateCell function
to keep styling consistent with the design system.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/features/markets/components/table/market-table-body.tsx`:
- Around line 38-54: In renderHistoricalRateCell replace the hardcoded
PulseLoader color="#f45f2d" with the app's theme token or CSS variable (e.g. use
theme.colors.brandOrange or a CSS var like var(--brand-orange)) so the loader
uses the shared brand orange; update the PulseLoader prop to reference the token
(via styled/theme hook or inline var) in the renderHistoricalRateCell function
to keep styling consistent with the design system.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d0889f80-291e-4a2e-a4b4-7ba3c0d561e2

📥 Commits

Reviewing files that changed from the base of the PR and between 77bad56 and 0b592fc.

📒 Files selected for processing (4)
  • AGENTS.md
  • src/features/markets/components/table/market-table-body.tsx
  • src/hooks/queries/useMarketMetricsQuery.ts
  • src/hooks/useProcessedMarkets.ts

@antoncoding antoncoding merged commit 56078b9 into master Mar 26, 2026
4 checks passed
@antoncoding antoncoding deleted the fix/indicators branch March 26, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui User interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant