From 39a3ee7ce72606c461993b11804a2bd4c815b996 Mon Sep 17 00:00:00 2001 From: Maurice Date: Wed, 17 Jun 2026 21:00:19 +0200 Subject: [PATCH] fix(collab): show poll option labels in the UI The poll API formatted each option as { label, voters }, but the React poll component renders opt.text - so every option button came out blank. Emit text alongside label (kept for any other consumer) so options render again. --- server/src/services/collabService.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/server/src/services/collabService.ts b/server/src/services/collabService.ts index 2b6b0b71..93f981d6 100644 --- a/server/src/services/collabService.ts +++ b/server/src/services/collabService.ts @@ -229,12 +229,17 @@ export function getPollWithVotes(pollId: number | bigint | string) { WHERE v.poll_id = ? `).all(pollId) as PollVoteRow[]; - const formattedOptions = options.map((label: string | { label: string }, idx: number) => ({ - label: typeof label === 'string' ? label : label.label || label, - voters: votes - .filter(v => v.option_index === idx) - .map(v => ({ id: v.user_id, user_id: v.user_id, username: v.username, avatar: v.avatar, avatar_url: avatarUrl(v) })), - })); + const formattedOptions = options.map((label: string | { label: string }, idx: number) => { + const text = typeof label === 'string' ? label : label.label || label; + return { + // The client renders `opt.text`; keep `label` too for any other consumer. + text, + label: text, + voters: votes + .filter(v => v.option_index === idx) + .map(v => ({ id: v.user_id, user_id: v.user_id, username: v.username, avatar: v.avatar, avatar_url: avatarUrl(v) })), + }; + }); return { ...poll,