fix(marketplace): surface vote failures#370
Conversation
Greptile SummaryThis PR fixes silent vote failures across all four marketplace vote widgets (directory, MCP, prompt, skill) by adding an
Confidence Score: 5/5Safe to merge — the changes are a straightforward, well-contained fix that replaces silent failures with visible error feedback across four widgets. All four widgets correctly surface API errors and network failures, reliably clear the loading state via No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant VoteButton
participant API
User->>VoteButton: click Upvote / Downvote
VoteButton->>VoteButton: setLoading(true), setError(null)
VoteButton->>API: "POST /api/{type}/{id}/vote"
alt HTTP 2xx
API-->>VoteButton: "{ upvotes, downvotes, score, user_vote }"
VoteButton->>VoteButton: update vote counts
else HTTP 4xx / 5xx
API-->>VoteButton: "{ error: "..." } (or non-JSON)"
VoteButton->>VoteButton: "setError(data.error || "Failed to update vote")"
else Network failure
API-->>VoteButton: fetch rejects (Error)
VoteButton->>VoteButton: setError("Failed to update vote")
end
VoteButton->>VoteButton: finally → setLoading(false)
VoteButton-->>User: re-enable buttons, show error alert (if any)
Reviews (2): Last reviewed commit: "fix(marketplace): declare vote action bu..." | Re-trigger Greptile |
Summary
finallyPaid task
https://ugig.net/gigs/abd6b2a0-e728-48cf-a46f-f99e419ed94e
Verification
pnpm exec vitest run src/components/MarketplaceVoteButton.test.tsxpnpm exec eslint src/components/directory/DirectoryVoteButton.tsx src/components/mcp/McpVoteButton.tsx src/components/prompts/PromptVoteButton.tsx src/components/skills/SkillVoteButton.tsx src/components/MarketplaceVoteButton.test.tsxgit diff --check