Skip to content

fix(frontend): fix no-device default, program role duplication, and auto-join race#618

Open
LucasMaupin wants to merge 3 commits intomainfrom
frontend/fix-no-device-default
Open

fix(frontend): fix no-device default, program role duplication, and auto-join race#618
LucasMaupin wants to merge 3 commits intomainfrom
frontend/fix-no-device-default

Conversation

@LucasMaupin
Copy link
Copy Markdown
Contributor

Summary

  • Device default bug: first-time users (or cleared localStorage) got "no-device" as the audio input device ID, causing 500 errors on join. A useEffect in user-settings-form.tsx now resets the field to the real default device once enumeration completes; use-submit-form.tsx adds a defense-in-depth guard that replaces a falsy or "no-device" value with userSettings.audioinput or "default".
  • Program feed UX: the Listener / Audio feed role selector was duplicated — shown both in the join form and in ProgramLineJoinCard. Removed it from the join form entirely; ProgramLineJoinCard is now the sole owner of role selection, eliminating the separate state and the correctness hazard for first-time users.
  • Program line auto-join race: two concurrent fixes — calls-page.tsx now tracks pending program keys in a ref updated synchronously (not in state, which was stale at effect time), and use-submit-form.tsx skips initiateProductionCall for program output lines so they are never auto-joined before the user selects a role.

Test plan

  • Tests pass (npm test — 140 tests)
  • TypeScript compiles (npm run typecheck)
  • Lint clean (npm run lint)
  • Fresh user (no localStorage): open join form, verify audio input field shows "default" or first enumerated device, not "no-device"
  • Join a regular line: verify initiateProductionCall fires and the call connects normally
  • Join a preset containing a program output line: verify ProgramLineJoinCard is shown (with role selector), and the line is NOT auto-joined before the user picks Listener or Audio feed
  • Select a program output line directly in the join form: verify the form submits without attempting to start a call, and ProgramLineJoinCard appears with role options

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

…on, and auto-join race

- Device default bug: first-time users (cleared localStorage) received
  "no-device" as audioinput, causing 500 errors on join. Add a useEffect
  in user-settings-form.tsx that resets the field to the real default
  device once enumeration completes; add a defense-in-depth guard in
  use-submit-form.tsx that falls back to userSettings.audioinput or
  "default" when the resolved value is falsy or "no-device".

- Program feed UX: remove the role selector (Listener / Audio feed
  checkboxes) from the join form entirely. ProgramLineJoinCard is now
  the sole place for role selection, eliminating duplicate state and the
  associated correctness hazard for first-time users.

- Program line auto-join bug: two fixes applied together:
  (1) calls-page.tsx used pendingProgramLines state in the auto-join
  effect, which could be stale at the time the effect ran — replaced
  with a ref (pendingProgramKeysRef) updated synchronously before
  setPendingProgramLines so the effect always reads the latest value.
  (2) use-submit-form.tsx unconditionally called initiateProductionCall
  even for program output lines — added a !selectedLine.programOutputLine
  guard so program lines are not auto-joined before the user picks a role.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
LucasMaupin and others added 2 commits March 27, 2026 14:31
…gn WebRTC modal

- Add TVIcon next to program output lines in presets-list and manage-presets-list
  with isProgramOutput purple background
- Refactor settings-modal.tsx to use the base Modal component, removing duplicated
  modal primitives from settings-modal-components.ts
- Rewrite generate-whip-whep-url-modal.tsx: single username field, WHIP/WHEP copy
  buttons, title changed to "WebRTC"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add `presetOrder` field to `CallData` and a `sortedEntries()` helper in
`use-call-list.ts` so CALLS_STATE_UPDATE and CALL_UPDATE messages always
list calls in preset position order rather than insertion order.

Build `callIndexMap` in `calls-page.tsx` using the same preset-order sort
(keyed by productionId:lineId via `presetOrderMap`) so incoming companion
actions (mute, volume, etc.) resolve to the correct call. Remove the
duplicate `callIndexMap` effect from `connect-to-ws-button.tsx` that was
overwriting the sorted map with insertion order on every state change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant