Skip to content

Conversation

@marcodejongh
Copy link
Owner

@marcodejongh marcodejongh commented Dec 27, 2025

Summary

  • Fix data validation error when clearing queue in party mode by properly handling null/undefined values in toClimbQueueItemInput
  • Add leader check to clear queue button - only visible to party leader in party mode, still available to all users in local mode
  • Add server-side enforcement - only party leader can clear the queue via setQueue mutation

Problem

When clicking "Clear queue" in party mode, users got this error:

Invalid currentClimbQueueItem: Invalid UUID format, Number must be less than or equal to 5,
Expected boolean, received null, Expected number, received null, Expected string, received null,
Expected array, received null

Root Cause

  1. Zod's .optional() allows undefined but NOT null, causing validation failures when queue item data contained null values from the database
  2. The clear queue button was visible to all users in party mode, but should only be available to the party leader

Changes

  1. use-queue-session.ts: Updated toClimbQueueItemInput to:

    • Provide defaults for required fields that might be null
    • Convert null to undefined for optional fields (mirrored, suggested, tickedBy, etc.)
  2. queue-control-bar.tsx: Added leader check:

    • Show clear button if queue.length > 0 AND (not in party mode OR is the party leader)
  3. resolvers.ts (backend): Added server-side enforcement:

    • Only the party leader can clear the queue (when queue.length === 0)
    • Throws error "Only the party leader can clear the queue" for non-leaders

Test plan

  • In local mode (no party session): Clear queue button works as before
  • In party mode as leader: Clear queue button is visible and works without validation errors
  • In party mode as non-leader: Clear queue button is NOT visible
  • Backend rejects clear queue requests from non-leaders with appropriate error

🤖 Generated with Claude Code

- Fix data validation in toClimbQueueItemInput by properly handling
  null/undefined values. Zod's .optional() allows undefined but not null,
  causing validation failures when sending queue data to backend.
- Add leader check to clear queue button - only show to party leader
  in party mode, while still allowing all users to clear in local mode.

Fixes the error: "Invalid currentClimbQueueItem: Invalid UUID format,
Number must be less than or equal to 5, Expected boolean, received null..."

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Dec 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
boardsesh Ready Ready Preview, Comment Dec 27, 2025 7:11am

Only the party leader can clear the queue. This adds server-side
enforcement to complement the client-side UI hiding.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 participants