-
Notifications
You must be signed in to change notification settings - Fork 1k
Potentially fix "Recording in progress" #1300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe Changes
Sequence DiagramsequenceDiagram
participant Caller
participant start_recording
participant actor_spawn
participant UI
participant cleanup
Caller->>start_recording: initiate recording start
start_recording->>actor_spawn: spawn actor
alt Spawn Success
actor_spawn-->>start_recording: Ok(rx)
start_recording->>start_recording: proceed with Rx future handling
else Spawn Failure
actor_spawn-->>start_recording: Err(error)
rect rgb(255, 200, 200)
Note over start_recording: Error handling path
start_recording->>UI: emit RecordingEvent::Failed
start_recording->>UI: show error dialog
start_recording->>cleanup: call handle_recording_end
end
start_recording-->>Caller: return with error
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
apps/desktop/src-tauri/src/recording.rs (4)
599-622: Early failure handling is user-friendly; avoid blocking in async and verify pending-state reset
- Nice: emit Failed, show dialog, cleanup via handle_recording_end; this likely fixes the lingering “Recording already in progress.”
- Avoid blocking the async thread: wrap blocking_show in spawn_blocking or use a non-blocking show if available.
Suggested change (keeps behavior, avoids blocking the runtime thread):
- dialog.blocking_show(); + tauri::async_runtime::spawn_blocking(move || dialog.blocking_show());Also, please verify:
- handle_recording_end resets any “pending” state (not just current recording), so RecordingState returns to None on this path.
- The “InProgressRecording” window is closed by handle_recording_end (it closes RecordingControls; ensure that maps to the same window ID in this flow).
646-658: Deduplicate error-dialog code into a helperThe dialog creation/emission logic is duplicated here and in the spawn failure branch. Consider extracting a small helper like show_error_dialog(app: &AppHandle, msg: &str) that handles optional parent window and display mode consistently.
277-281: Avoid unwrap on app_data_dir() to prevent hard crashapp_data_dir() can return None. Convert to a user-visible error instead of panic:
- .app_data_dir() - .unwrap() + .app_data_dir() + .ok_or_else(|| "Failed to resolve app data directory".to_string())?
703-706: Minor: remove redundant?afterErrUse a straightforward early return:
- return Err("Recording not in progress".to_string())?; + return Err("Recording not in progress".to_string());
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/desktop/src-tauri/src/recording.rs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/*.rs: Format Rust code usingrustfmtand ensure all Rust code passes workspace-level clippy lints.
Rust modules should be named with snake_case, and crate directories should be in kebab-case.
Files:
apps/desktop/src-tauri/src/recording.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
- GitHub Check: Analyze (rust)
🔇 Additional comments (1)
apps/desktop/src-tauri/src/recording.rs (1)
594-598: Good normalization of join errors for flatten()Mapping JoinError to String before awaiting enables Result::flatten with a consistent error type. Looks correct.
Summary by CodeRabbit