fix(arcade): add automatic retry for version conflict rejections
When a move is rejected due to a version conflict (optimistic locking), automatically retry the move after a brief delay. This handles the case where moves arrive faster than the database can commit them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -115,7 +115,14 @@ export function useArcadeSession<TState>(
|
||||
},
|
||||
|
||||
onMoveRejected: (data) => {
|
||||
console.log(`[ArcadeSession] Move rejected: ${data.error}`)
|
||||
// For version conflicts, automatically retry the move
|
||||
if (data.versionConflict) {
|
||||
// Wait a tiny bit for server state to propagate, then retry
|
||||
setTimeout(() => {
|
||||
socketSendMove(userId, data.move, roomId)
|
||||
}, 10)
|
||||
}
|
||||
|
||||
optimistic.handleMoveRejected(data.error, data.move)
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user