Uh oh!
There was an error while loading. Please reload this page.
Conversation
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughAdds selectable balance aggregation granularity (yearly/monthly/daily) across UI and SDK, clamps and selects period buckets for metrics, deduplicates chart points by second, extends query keys/options to include granularity, updates i18n strings, and switches poll vote broadcast to usePollVote with stricter validation. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as Client UI
participant Q as React Query
participant SDK as SDK (getAggregatedBalanceQueryOptions)
participant API as REST API
UI->>Q: request aggregated history (username, coinType, granularity)
Q->>SDK: build query key & options (includes granularity)
SDK->>API: GET /aggregated-history?granularity=...
API-->>SDK: aggregated periods response
SDK-->>Q: return data
Q-->>UI: provide aggregated periods
UI->>UI: clamp periodIndex, compute current/change/min/max from selected period
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/web/src/features/polls/api/sign-poll-vote.ts (1)
39-49:⚠️ Potential issue | 🟡 MinorGuard against
activeUserbecoming undefined during async mutation.The
activeUserreference is captured from the hook's render-time closure. If the user logs out while the mutation is in flight,activeUsercould beundefinedwhenonSuccessfires, potentially causing issues inPollsVotesManagement.processVoting.🛡️ Proposed defensive guard
onSuccess: (resp) => queryClient.setQueryData<Poll>( QueryKeys.polls.details(poll?.author ?? "", poll?.permlink ?? ""), (data) => { - if (!data || !resp) {+ if (!data || !resp || !activeUser) { return data; } return PollsVotesManagement.processVoting(activeUser, data, resp.choiceNums); } ),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/src/features/polls/api/sign-poll-vote.ts` around lines 39 - 49, The onSuccess handler captures activeUser from render-time and may be undefined when the mutation completes; update the handler in sign-poll-vote.ts (the onSuccess -> queryClient.setQueryData callback) to defensively guard before calling PollsVotesManagement.processVoting: if activeUser is falsy, either return the existing data unchanged or resolve the current active user from the query cache (e.g., read the auth/user query from queryClient) and only call PollsVotesManagement.processVoting when a non-null user is available; ensure you reference the same symbols (onSuccess, queryClient.setQueryData, PollsVotesManagement.processVoting, activeUser) so the guard lives right before the processVoting call.
♻️ Duplicate comments (1)
apps/web/src/app/(dynamicPages)/profile/[username]/wallet/(token)/_components/aggregated-balance-card.tsx (1)
164-170:⚠️ Potential issue | 🟡 MinorGranularity select is still missing an accessible label.
Line 164 renders a
<select>without an associated<label>oraria-label, so assistive tech may announce it as unlabeled. Please add a translated visible label oraria-label(similar to Line 185 usage).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/src/app/`(dynamicPages)/profile/[username]/wallet/(token)/_components/aggregated-balance-card.tsx around lines 164 - 170, The select rendered by the FormControl component (props: full, type="select", size="xs", value={granularity}, onChange={handleGranularityChange}) lacks an accessible label; update the FormControl usage to include an associated visible translated label or an aria-label (use the same translation key/pattern used on Line 185) so assistive technologies can announce it; ensure the label text comes from the i18n/t function and that the label prop or aria-label value clearly describes the granularity control.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/web/src/features/polls/api/sign-poll-vote.ts`:
- Around line 31-33: The check for empty choices uses the same error key as the
"not found" case which is misleading; update the i18next call in
sign-poll-vote.ts (the branch that checks choiceNums.length === 0) to use a new
key like "polls.no-choice-selected" instead of "polls.not-found", and add the
corresponding string ("Please select at least one choice") to the locale file
(e.g., en-US.json) so the new key resolves correctly.
---
Outside diff comments:
In `@apps/web/src/features/polls/api/sign-poll-vote.ts`:
- Around line 39-49: The onSuccess handler captures activeUser from render-time
and may be undefined when the mutation completes; update the handler in
sign-poll-vote.ts (the onSuccess -> queryClient.setQueryData callback) to
defensively guard before calling PollsVotesManagement.processVoting: if
activeUser is falsy, either return the existing data unchanged or resolve the
current active user from the query cache (e.g., read the auth/user query from
queryClient) and only call PollsVotesManagement.processVoting when a non-null
user is available; ensure you reference the same symbols (onSuccess,
queryClient.setQueryData, PollsVotesManagement.processVoting, activeUser) so the
guard lives right before the processVoting call.
---
Duplicate comments:
In
`@apps/web/src/app/`(dynamicPages)/profile/[username]/wallet/(token)/_components/aggregated-balance-card.tsx:
- Around line 164-170: The select rendered by the FormControl component (props:
full, type="select", size="xs", value={granularity},
onChange={handleGranularityChange}) lacks an accessible label; update the
FormControl usage to include an associated visible translated label or an
aria-label (use the same translation key/pattern used on Line 185) so assistive
technologies can announce it; ensure the label text comes from the i18n/t
function and that the label prop or aria-label value clearly describes the
granularity control.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4d14bf74-928d-4d5a-a122-7d0dbda32e27
⛔ Files ignored due to path filters (7)
packages/sdk/dist/browser/index.d.tsis excluded by!**/dist/**packages/sdk/dist/browser/index.jsis excluded by!**/dist/**packages/sdk/dist/browser/index.js.mapis excluded by!**/dist/**,!**/*.mappackages/sdk/dist/node/index.cjsis excluded by!**/dist/**packages/sdk/dist/node/index.cjs.mapis excluded by!**/dist/**,!**/*.mappackages/sdk/dist/node/index.mjsis excluded by!**/dist/**packages/sdk/dist/node/index.mjs.mapis excluded by!**/dist/**,!**/*.map
📒 Files selected for processing (7)
apps/web/public/sw.jsapps/web/src/app/(dynamicPages)/profile/[username]/wallet/(token)/_components/aggregated-balance-card.tsxapps/web/src/app/(dynamicPages)/profile/[username]/wallet/(token)/_components/balance-history-chart.tsxapps/web/src/features/i18n/locales/en-US.jsonapps/web/src/features/polls/api/sign-poll-vote.tspackages/sdk/src/modules/core/query-keys.tspackages/sdk/src/modules/polls/mutations/use-poll-vote.ts
✅ Files skipped from review due to trivial changes (1)
- packages/sdk/src/modules/polls/mutations/use-poll-vote.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/web/src/app/(dynamicPages)/profile/[username]/wallet/(token)/_components/balance-history-chart.tsx
- packages/sdk/src/modules/core/query-keys.ts
- apps/web/src/features/i18n/locales/en-US.json
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation