Skip to content

feat: implement optimistic UI updates for upvotes #25

@anxkhn

Description

@anxkhn

Problem Description

Upvote button waits for server response before updating the UI, causing perceived lag.

Context

Optimistic UI updates improve perceived performance by updating the UI immediately.

Files to Investigate

  • src/components/upvote-button.tsx - Upvote component
  • src/actions/events.ts - upvoteEvent action

Steps to Reproduce

  1. Click upvote on an event
  2. Notice delay before count updates
  3. UI should update immediately

Expected Behavior

UI should update immediately with rollback on error.

Acceptance Criteria

  • Implement useOptimistic or custom hook
  • Immediate UI feedback
  • Rollback on server error
  • Handle concurrent upvotes correctly

Suggested Approach

Use React 19's useOptimistic hook or implement custom optimistic state management.

Difficulty: Hard

Estimated time: 3-6 hours
Prerequisites: React hooks, state management
Learning outcomes: Optimistic UI patterns, React 19 features

Metadata

Metadata

Assignees

No one assigned

    Labels

    advancedComplex challenge (3-6 hours)enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions