fix(webchat): use label fallback in session dropdown

Empty string labels were showing blank instead of falling back to displayName because ?? only handles null/undefined. Changed to || to handle empty strings.
This commit is contained in:
Zarian Lewis 2026-01-28 17:23:17 -06:00
parent 01e0d3a320
commit e6de5c9a8f

View File

@ -140,14 +140,14 @@ function resolveSessionOptions(sessionKey: string, sessions: SessionsListResult
// Add current session key first
seen.add(sessionKey);
options.push({ key: sessionKey, displayName: resolvedCurrent?.displayName });
options.push({ key: sessionKey, displayName: resolvedCurrent?.label || resolvedCurrent?.displayName });
// Add sessions from the result
if (sessions?.sessions) {
for (const s of sessions.sessions) {
if (!seen.has(s.key)) {
seen.add(s.key);
options.push({ key: s.key, displayName: s.displayName });
options.push({ key: s.key, displayName: s.label || s.displayName });
}
}
}