Skip to content

Proposal fixes - #3194

Merged
feruzm merged 2 commits into
developmentfrom
prop
May 19, 2026
Merged

Proposal fixes#3194
feruzm merged 2 commits into
developmentfrom
prop

Conversation

@feruzm

@feruzm feruzm commented May 18, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Fixed proposal vote banner visibility to persist after successful voting within a session
    • Improved vote button loading state indicator accuracy during submission
    • Enhanced vote metadata caching to maintain consistency with blockchain results
  • Improvements

    • Refined proposal filtering to better surface votable proposals
    • Strengthened vote matching with improved error handling and validation

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6902ede9-9ed5-4b21-b13f-304a9d70bfe5

📥 Commits

Reviewing files that changed from the base of the PR and between 101273f and bb3a965.

📒 Files selected for processing (2)
  • src/components/proposalVoteRequest/container/proposalVoteRequest.tsx
  • src/providers/queries/proposalQueries.ts

📝 Walkthrough

Walkthrough

Component post-vote UI state and query/mutation hooks are refactored to improve proposal voting. The component now keeps the post-vote banner mounted on successful vote, query hooks refactor vote metadata caching with username scoping, and mutation execution shifts to SDK operation builders with explicit cache invalidation.

Changes

Proposal Voting Flow Refactor

Layer / File(s) Summary
Post-vote UI state management
src/components/proposalVoteRequest/container/proposalVoteRequest.tsx
skipRender returns false on proposalVoteMutation.isSuccess to keep banner mounted; dependencies updated to include success state; button loading prop changed from isLoading to isPending.
Proposal query and vote mutation refactoring
src/providers/queries/proposalQueries.ts
Imports updated to add useQueryClient and buildProposalVoteOp; active proposal selection logic treats non-expired as votable; useProposalVotedQuery keys cache by ${proposalId}_${username} with optional chaining and safely normalizes proposal ID; useProposalVoteMutation builds operations via SDK helper, requires active username, disables retry, and invalidates user-vote query on success.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ecency/ecency-mobile#3119: Both PRs modify proposalVoteRequest.tsx's skipRender memo and dependencies in relation to vote mutation state.

Poem

🐰 A vote succeeds, the banner stays!
Cache keys dance in username ways,
Operations built by helpers true,
The voting flow runs fresh and new. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Proposal fixes' is too vague and generic; it does not clearly specify what proposal-related issues are being addressed or which aspects of the proposal system were modified. Consider a more descriptive title that highlights the specific changes, such as 'Fix proposal vote mutation cache handling and skipRender logic' or similar.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch prop

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.

@greptile-apps

greptile-apps Bot commented May 18, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes several bugs in the proposal-vote feature: widening the status filter to surface upcoming (not-yet-started) proposals, removing a cache-corrupting initialData: false, adding null-safety guards for unauthenticated states, replacing an inline operation object with the buildProposalVoteOp SDK helper, and keeping the post-vote "thank you" banner visible in the current session via an isSuccess guard.

  • Status filter fix: changes status === 'active' to status !== 'expired', allowing users to vote on proposals that are already funded but haven't started yet.
  • Cache fix: removes initialData: false from useProposalVotedQuery so the shared query-cache entry stays ProposalVote[] instead of being seeded with a boolean.
  • Post-vote UX: adds proposalVoteMutation.isSuccess to skipRender so the "thank you" state renders immediately after voting without waiting for the on-chain confirmation query to refresh.

Confidence Score: 5/5

Safe to merge — all changes are targeted bug fixes with no regressions on the hot path.

The changes are well-scoped defensive improvements: null-safety guards, a narrowed cache write (removing the boolean initialData), an SDK helper adoption, and a small UX fix for the post-vote banner. The logic around skipRender is carefully ordered so !isLoggedIn still gates everything.

No files require special attention.

Important Files Changed

Filename Overview
src/providers/queries/proposalQueries.ts Defensive null-safety improvements, initialData removal to fix shared cache corruption, status filter widened to include upcoming proposals, buildProposalVoteOp SDK helper adopted, query invalidation on success added.
src/components/proposalVoteRequest/container/proposalVoteRequest.tsx isLoadingisPending (TanStack Query v5), isSuccess guard added to keep the "thank you" banner mounted this session after a successful vote.

Sequence Diagram

sequenceDiagram
    participant UI as ProposalVoteRequest
    participant VQ as useProposalVotedQuery
    participant VM as useProposalVoteMutation
    participant QC as QueryClient
    participant Chain as Hive Chain

    UI->>VQ: query(proposalId, username)
    VQ-->>UI: "data=false (not voted)"
    Note over UI: skipRender=false → banner shown

    UI->>VM: "mutate({ proposalId })"
    VM->>Chain: buildProposalVoteOp → broadcast
    Chain-->>VM: success
    VM->>QC: invalidateQueries(userVotesKey)
    VM->>UI: "isSuccess=true"
    Note over UI: skipRender=false (isSuccess guard)<br/>voteCasted=true → thank-you state

    QC->>VQ: refetch
    VQ-->>UI: "data=true (voted)"
    Note over UI: On next session: data=true → skipRender=true
Loading

Reviews (2): Last reviewed commit: "fix op" | Re-trigger Greptile

Comment thread src/providers/queries/proposalQueries.ts Outdated
Comment thread src/providers/queries/proposalQueries.ts Outdated
@feruzm
feruzm merged commit 25b365e into development May 19, 2026
4 of 6 checks passed
@feruzm
feruzm deleted the prop branch May 19, 2026 13:16
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.

1 participant