Skip to content
Open
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
34 changes: 17 additions & 17 deletions src/components/RecordButton/RecordButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,23 @@ function RecordButton({
};
}, []);

const stopRecording = React.useCallback(() => {
if (timerRef.current) {
clearInterval(timerRef.current);
}

if (
mediaRecorderRef.current &&
mediaRecorderRef.current.state !== 'inactive'
) {
mediaRecorderRef.current.stop();
}

if (streamRef.current) {
streamRef.current.getTracks().forEach((track) => track.stop());
}
}, []);
Comment on lines +264 to +279
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Consider adding/expanding a Playwright Storybook render/visual test that covers the Dashboard story (or a RecordButton story) to prevent regressions where RecordButton fails to render due to hook callback ordering/initialization errors (this bug was only caught at runtime in Storybook).

Copilot uses AI. Check for mistakes.

const startRecording = React.useCallback(async () => {
if (disabled || isRecording || isProcessing) return;

Expand Down Expand Up @@ -327,23 +344,6 @@ function RecordButton({
stopRecording,
]);

const stopRecording = React.useCallback(() => {
if (timerRef.current) {
clearInterval(timerRef.current);
}

if (
mediaRecorderRef.current &&
mediaRecorderRef.current.state !== 'inactive'
) {
mediaRecorderRef.current.stop();
}

if (streamRef.current) {
streamRef.current.getTracks().forEach((track) => track.stop());
}
}, []);

const handleClick = React.useCallback(() => {
if (isRecording) {
stopRecording();
Expand Down
Loading