fix: add userId to optimistic player in useCreatePlayer
Add temporary userId property to optimistic player object to satisfy Player type requirements. The Player type requires userId, but createPlayer only accepts name/emoji/color. The optimistic update now includes a temporary userId that gets replaced by the server response. Fixes 1 TS2741 error in useUserPlayers.ts:108. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -110,6 +110,7 @@ export function useCreatePlayer() {
|
||||
...newPlayer,
|
||||
createdAt: new Date(),
|
||||
isActive: newPlayer.isActive ?? false,
|
||||
userId: 'temp-user', // Temporary userId, will be replaced by server response
|
||||
}
|
||||
queryClient.setQueryData<Player[]>(playerKeys.list(), [
|
||||
...previousPlayers,
|
||||
|
||||
Reference in New Issue
Block a user