Skip to content

Conversation

@marcodejongh
Copy link
Owner

Summary

  • Fixes race condition where session-joined arrived before QueueProvider subscribed, causing new users to miss initial queue state
  • Fixes issue where queue changes were being reverted due to stale initial data being replayed on re-subscription
  • Adds request-queue-state message type for explicit queue state requests (enables future re-sync on reconnection)

Changes

Daemon:

  • Add RequestQueueStateMessage and QueueStateResponseMessage types
  • Add handleRequestQueueState handler in room.ts
  • Route request-queue-state messages in message.ts

Client:

  • Store initial queue data in DaemonContext and provide to late subscribers
  • Use refs in QueueProvider to stabilize handlePeerData callback (prevents re-subscription on queue changes)
  • Add hasReceivedInitialData flag to prevent replaying initial data multiple times
  • Fix reconnection loop by using refs for callbacks in connect()

Test plan

  • Start daemon and create a session with User A
  • Add items to the queue with User A
  • Have User B join the session
  • Verify User B sees the existing queue items immediately
  • Verify queue changes sync correctly between users
  • Verify queue changes are not reverted after making them

🤖 Generated with Claude Code

When a user joined a party mode session via daemon/websocket, they would
not receive the initial queue state - only seeing updates made after joining.

Root causes:
1. Race condition where session-joined arrived before QueueProvider subscribed
2. Re-subscription on every queue change replayed stale initial data

Changes:
- Add request-queue-state message type for explicit queue state requests
- Store initial queue data in DaemonContext and provide to late subscribers
- Use refs in QueueProvider to stabilize handlePeerData callback
- Add hasReceivedInitialData flag to prevent replaying initial data
- Fix reconnection loop by using refs for callbacks in connect()

🤖 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 21, 2025

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

Project Deployment Review Updated (UTC)
boardsesh Error Error Dec 21, 2025 10:20pm

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