Leaving PodcastRecorder does not stop an active native recording#2058
Leaving PodcastRecorder does not stop an active native recording#2058karrisanthoshigayatri wants to merge 3 commits into
Conversation
|
Thank you @, for creating the PR and contributing to our UltimateHealth project 💗. |
Automated Review FeedbackProvide actionable comments grouped by severity: Critical
Suggestions
|
karrisanthoshigayatri
left a comment
There was a problem hiding this comment.
I checked the implementation. Could you please point me to the specific line where handleUpload was moved from useFocusEffect to useEffect? I couldn't find that change.
|
/review |
🤖 Gemini AI Code ReviewSummaryThis Pull Request addresses a critical bug where an active native recording was not properly stopped when the While the PR correctly identifies and implements the core fix for stopping the native recording and restoring audio mode, there's a significant logic flaw in how 🔴 High Severity
// Stop any active recording and release resources when the screen loses focus
// (back navigation, screen replacement, etc.).
useFocusEffect(
useCallback(() => {
// Call handleUpload when the screen gains focus, as per original intent.
handleUpload();
return () => {
// Always stop the JS timer first.
stopTimer();
if (isRecordingRef.current) {
isRecordingRef.current = false;
audioRecorder.stop().catch(err =>
console.warn('Error stopping recorder on screen exit:', err),
);
// Restore audio mode so other screens are not affected.
setAudioModeAsync({
playsInSilentMode: false,
allowsRecording: false,
}).catch(err =>
console.warn('Error restoring audio mode on screen exit:', err),
);
// Reset visual state so the screen looks correct if revisited.
setRecording(false);
setUiState('idle');
setRecordTime('00:00:00');
}
};
}, [audioRecorder, handleUpload]), // Ensure handleUpload is a dependency if it's a useCallback
);
// Remove the separate useEffect for handleUpload as it's now handled above.
// useEffect(() => {
// handleUpload();
// // eslint-disable-next-line react-hooks/exhaustive-deps
// }, []);🟡 Medium Severity
-import {Alert, AppState, AppStateStatus} from 'react-native';
+import {Alert, AppStateStatus} from 'react-native';🟢 Low Severity / Nits
What's Good ✅
VerdictRequest Changes The most critical issue is the incorrect implementation of the |
SB2318
left a comment
There was a problem hiding this comment.
@karrisanthoshigayatri Thanks for your contribution! Please fix the bot points.
Leaving PodcastRecorder does not stop an active native recording SB2318#2058
#1914
PR Description
Please include a summary of the changes and the related issue. Describe your changes in detail.
Type of Change
Select your work-area
Related Issue
Please provide a link to the issue solved if applicable.
Add your Work Example
📷 Add a Snapshot
Fixes (mention the issue number which this fixes)
#closes
Checklist
Undertaking
My code follows the style guidelines of this project.
I have performed a self-review of my code.
I have commented my code, particularly in hard-to-understand areas.
I have made corresponding changes to the documentation.
I have checked for plagiarism and assure its authenticity.
I have read and followed the code of conduct for this repository. I understand that violation of this undertaking may have legal consequences.
I Agree