Fix points activities#3106
Conversation
📝 WalkthroughWalkthroughRemoves development console logs across several files and integrates a POINTS data path into wallet queries, adding pointsQuery usage and branching in activities/refresh/pagination logic while grooming POINTS transactions for UI consumption. (49 words) Changes
Sequence Diagram(s)sequenceDiagram
participant UI as Client/UI
participant WalletQ as WalletQueries
participant PointsSvc as POINTS Query (SDK)
participant Engine as Engine/Chain Query
participant DB as Local State (balance/userActivities)
UI->>WalletQ: request activities (layer)
alt layer == "points"
WalletQ->>PointsSvc: fetch points transactions
PointsSvc-->>WalletQ: points data
WalletQ->>WalletQ: groomingPointsTransactionData(map with POINTS metadata)
else layer == "engine/chain"
WalletQ->>Engine: fetch engine/chain transactions
Engine-->>WalletQ: transactions
WalletQ->>WalletQ: existing grooming flow
end
WalletQ->>DB: update balance, userPoints, userActivities
DB-->>UI: updated activities/balance
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/providers/queries/walletQueries/walletQueries.ts`:
- Around line 353-364: When mapping POINTS transactions in the points branch
(use pointsQuery.data?.transactions), ensure you fall back to POINTS.default for
unknown item.type values so required fields aren't undefined; update the three
lookups used for the groomingPointsTransactionData call (icon, iconType,
textKey) to use POINTS[get(item, 'type')] || POINTS.default. Apply the same
fallback pattern in pointsContainer.ts for the equivalent lookups (the ones on
lines around the pointsContainer mapping) so both places always supply string
values for icon, iconType and textKey.
🧹 Nitpick comments (1)
src/providers/queries/walletQueries/walletQueries.ts (1)
297-301: Consider reusinguseGetPointsQueryto avoid duplication.This query duplicates the logic in
useGetPointsQueryfrompointQueries.ts, which also wrapsgetPointsQueryOptions. While both will share the same React Query cache (same query key), consolidating to a single hook would improve maintainability.♻️ Suggested refactor
Import and use the existing hook instead:
+import { useGetPointsQuery } from '../pointQueries';Then replace the inline query:
- // For POINTS, use SDK points query to get activities from Ecency API - const pointsQuery = useQuery({ - ...getPointsQueryOptions(username, 0), - enabled: !!username && isPoints, - }); + // For POINTS, use SDK points query to get activities from Ecency API + const pointsQuery = useGetPointsQuery(isPoints ? username : undefined, 0);Note: This would require adjusting
useGetPointsQueryto acceptundefinedas username (which it already does based on its signature).
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.