Skip to content

Fix/vote optimistic rollback - #21

Merged
Yentec merged 3 commits into
mainfrom
fix/vote-optimistic-rollback
Jun 11, 2026
Merged

Fix/vote optimistic rollback#21
Yentec merged 3 commits into
mainfrom
fix/vote-optimistic-rollback

Conversation

@Yentec

@Yentec Yentec commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Description

Fix optimistic vote rollback on action failure

Changes

  • Added router.refresh() in the error branch of VoteButton.handleClick — useOptimistic does not roll back automatically; router.refresh() triggers a server re-render that resets the optimistic state to the real value

Validation

  • Clean typecheck
  • Build successful
  • Existing unit tests pass (server/actions/tests/votes.test.ts)
  • Manually verified: failed vote (e.g. rate-limited) reverts the UI count

Closes #14

@Yentec
Yentec merged commit 51d311a into main Jun 11, 2026
3 checks passed
@Yentec
Yentec deleted the fix/vote-optimistic-rollback branch June 11, 2026 10:33
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.

enhance: optimistic rollback on failed vote

1 participant