Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions sample-apps/react/react-dogfood/components/ClosedCaptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
CompositeButton,
Icon,
OwnCapability,
TranscriptionSettingsResponseClosedCaptionModeEnum,
useCall,
useCallStateHooks,
useI18n,
Expand All @@ -13,13 +14,19 @@ import {
export const ToggleClosedCaptionsButton = () => {
const call = useCall();
const { t } = useI18n();
const { useIsCallCaptioningInProgress, useHasPermissions } =
const { useCallSettings, useIsCallCaptioningInProgress, useHasPermissions } =
useCallStateHooks();
const settings = useCallSettings();
const isCaptioned = useIsCallCaptioningInProgress();
const canToggle = useHasPermissions(
OwnCapability.START_CLOSED_CAPTIONS_CALL,
OwnCapability.STOP_CLOSED_CAPTIONS_CALL,
);
const canStart = useHasPermissions(OwnCapability.START_CLOSED_CAPTIONS_CALL);
const canStop = useHasPermissions(OwnCapability.STOP_CLOSED_CAPTIONS_CALL);
const canToggle = isCaptioned ? canStop : canStart;
const isClosedCaptionsEnabled =
settings?.transcription.closed_caption_mode !==
TranscriptionSettingsResponseClosedCaptionModeEnum.DISABLED;

if (!isClosedCaptionsEnabled || (!canStart && !canStop)) return null;
Comment on lines +24 to +28

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟑 Minor | ⚑ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 12 \
  '\b(useCallSettings|closed_caption_mode|ToggleClosedCaptionsButton)\b' \
  packages/react-sdk packages/client sample-apps/react/react-dogfood \
  --glob '*.{ts,tsx}'

Repository: GetStream/stream-video-js

Length of output: 50381


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- ClosedCaptions component ---'
sed -n '1,130p' sample-apps/react/react-dogfood/components/ClosedCaptions.tsx

printf '%s\n' '--- useCallSettings definitions and state selectors ---'
rg -n -C 8 \
  'useCallSettings|callSettings|settings\??:' \
  packages/react-sdk/src \
  --glob '*.{ts,tsx}' \
  | head -n 500

printf '%s\n' '--- Call context mounting and call lifecycle around ActiveCall ---'
rg -n -C 8 \
  'ActiveCall|StreamCall|StreamVideo|call\.join|callingState|CallState' \
  sample-apps/react/react-dogfood \
  --glob '*.{ts,tsx}' \
  | head -n 500

Repository: GetStream/stream-video-js

Length of output: 50381


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Exact useCallSettings implementation ---'
rg -l 'useCallSettings' packages/react-sdk/src --glob '*.{ts,tsx}' |
  while IFS= read -r file; do
    if rg -q 'useCallSettings' "$file"; then
      printf '\n### %s\n' "$file"
      rg -n -C 15 'useCallSettings' "$file"
    fi
  done

printf '%s\n' '--- ActiveCall render conditions ---'
rg -n -C 15 \
  'export const ActiveCall|<ActiveCall|ToggleClosedCaptionsButton|CallingState|call\.get|getOrCreate' \
  sample-apps/react/react-dogfood/components/ActiveCall.tsx \
  sample-apps/react/react-dogfood/pages \
  --glob '*.{ts,tsx}' \
  | head -n 700

printf '%s\n' '--- Tests for call settings and closed captions ---'
rg -n -C 10 \
  'useCallSettings|ClosedCaptions|closed_caption_mode|START_CLOSED_CAPTIONS_CALL|STOP_CLOSED_CAPTIONS_CALL' \
  packages/react-sdk sample-apps/react/react-dogfood \
  --glob '*.{test,spec}.{ts,tsx}' \
  --glob '*__tests__*'

Repository: GetStream/stream-video-js

Length of output: 43728


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Call-state hook factory and selector source ---'
rg -n -C 12 \
  'useCallStateHooks|CallStateHooks|useCallSettings|callSettings' \
  packages \
  --glob '*.{ts,tsx}' \
  --glob '!**/gen/**' \
  --glob '!**/__tests__/data.ts' \
  | grep -E '(^[^-].*|useCallStateHooks|CallStateHooks|useCallSettings|callSettings)' \
  | head -n 800

printf '%s\n' '--- All files that define or export call-state hooks ---'
rg -l \
  'useCallStateHooks|useCallSettings' \
  packages \
  --glob '*.{ts,tsx}' \
  --glob '!**/gen/**' \
  | sort

printf '%s\n' '--- Call state initialization and settings loading ---'
rg -n -C 12 \
  'settings:|callSettings|call\.get\(|call\.getOrCreate\(|getOrCreate\(' \
  packages/client/src \
  --glob '*.{ts,tsx}' \
  | head -n 800

Repository: GetStream/stream-video-js

Length of output: 50383


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Candidate binding and call-state files ---'
git ls-files | rg \
  '(^|/)(react-bindings|.*CallState.*|.*call.*state.*|.*hooks.*)\.(ts|tsx)$' \
  | head -n 300

printf '%s\n' '--- Hook factory declarations and exports ---'
rg -n \
  'export .*useCallStateHooks|function useCallStateHooks|const useCallStateHooks|create.*Call.*State|CallState.*Hooks' \
  . \
  --glob '*.{ts,tsx}' \
  --glob '!**/gen/**' \
  --glob '!**/node_modules/**' \
  --glob '!**/dist/**' \
  --glob '!**/build/**' \
  | head -n 300

printf '%s\n' '--- Call settings state assignments ---'
rg -n -C 8 \
  'callState\.settings|state\.settings|settings\s*=' \
  packages/client/src \
  --glob '*.{ts,tsx}' \
  | head -n 400

Repository: GetStream/stream-video-js

Length of output: 50381


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- useCallSettings selector ---'
rg -n -C 12 \
  'useCallSettings|settings\$|settings' \
  packages/react-bindings/src/hooks/callStateHooks.ts

printf '%s\n' '--- CallState settings declaration and updates ---'
rg -n -C 15 \
  'settings|callSettings|call\.settings' \
  packages/client/src/store/CallState.ts

printf '%s\n' '--- Call get/getOrCreate state hydration ---'
rg -n -C 15 \
  'getOrCreate|get\(|settings' \
  packages/client/src/Call.ts \
  packages/client/src \
  --glob '*Call*.ts' \
  | head -n 600

Repository: GetStream/stream-video-js

Length of output: 50381


Require loaded call settings before rendering closed captions.

settings$ starts as undefined and receives data only after get() or getOrCreate() updates call state. The current comparison enables the control during this interval. Require settings != null before evaluating closed_caption_mode, and add a regression test.

πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sample-apps/react/react-dogfood/components/ClosedCaptions.tsx` around lines
24 - 28, Update the isClosedCaptionsEnabled/render guard in ClosedCaptions so
closed captions remain hidden while settings is null or undefined, requiring
loaded settings before evaluating closed_caption_mode; preserve the existing
disabled-mode and canStart/canStop checks, and add a regression test covering
the initial unloaded settings state.

Source: MCP tools


return (
<WithTooltip title={t('Toggle closed captions')}>
<CompositeButton
Expand Down
Loading