Skip to content

Conversation

@yujonglee
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Nov 7, 2025

📝 Walkthrough

Walkthrough

This PR introduces onboarding state management and conditional window display logic. It adds a new StoreKey enum and AppExt trait for persisting onboarding state via tauri_plugin_store2, exposes two commands for frontend access to onboarding state, modifies the app startup to conditionally display onboarding or main windows, removes the calendars step from onboarding, and makes window plugin methods public.

Changes

Cohort / File(s) Summary
Store & AppExt Infrastructure
apps/desktop/src-tauri/Cargo.toml, apps/desktop/src-tauri/src/store.rs, apps/desktop/src-tauri/src/ext.rs
Added tauri-plugin-store2 and strum dependencies; created StoreKey enum with OnboardingNeeded2 variant implementing ScopedStoreKey; introduced AppExt trait with desktop_store, get_onboarding_needed, and set_onboarding_needed methods with blanket impl for all tauri::Manager types.
Commands & Integration
apps/desktop/src-tauri/src/commands.rs, apps/desktop/src-tauri/src/lib.rs
Added get_onboarding_needed and set_onboarding_needed async commands wrapping AppExt methods; integrated tauri_plugin_store2 into plugin stack; exposed ext and store modules; registered new commands in Specta builder; reworked startup flow to conditionally show/hide/destroy onboarding vs. main windows based on stored state.
Frontend Onboarding
apps/desktop/src/components/onboarding/permissions.tsx, apps/desktop/src/routes/app/onboarding/index.tsx
Removed action prop from OnboardingContainer in permissions component; removed calendars step entirely from onboarding flow; added call to commands.setOnboardingNeeded(false) on onboarding completion; adjusted container padding (py-12 → pt-20 pb-12).
Window Plugin
plugins/windows/src/ext.rs
Made hide and destroy methods on AppWindow public.
Cleanup
crates/notification/src/lib.rs, packages/utils/src/index.ts
Removed unused std::process::Command import; removed unused fetch module re-export.

Sequence Diagram

sequenceDiagram
    participant App as App Startup
    participant Store as Desktop Store
    participant UI as Frontend Window
    
    App->>Store: Check OnboardingNeeded2
    alt Onboarding needed
        Store-->>App: true (or missing)
        App->>UI: Show Onboarding window
        UI->>UI: User completes flow
        UI->>Store: setOnboardingNeeded(false)
        Store-->>UI: Persisted
        App->>UI: Show Main window
        App->>App: Close Onboarding window
    else Onboarding complete
        Store-->>App: false
        App->>UI: Show Main window
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Key areas requiring attention:
    • apps/desktop/src-tauri/src/lib.rs: Verify the window visibility logic correctly handles all states (onboarding needed vs. complete) and properly destroys/hides windows at the right lifecycle points.
    • apps/desktop/src-tauri/src/ext.rs: Confirm error handling in store access and that the default value of true for get_onboarding_needed when the key is absent is the intended behavior.
    • apps/desktop/src/routes/app/onboarding/index.tsx: Verify the placement of setOnboardingNeeded(false) call ensures it fires before window transitions and that the removal of the calendars step doesn't break any dependent logic.

Possibly related PRs

  • Fix external stt server startups #1402: Modifies apps/desktop/src-tauri/src/ext.rs and the AppExt trait implementation with different methods, indicating parallel trait development.
  • Overlay floating control #908: Modifies plugins/windows/src/ext.rs to refactor window lifecycle methods (close/hide/destroy), complementary to this PR's exposure of hide and destroy as public.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether any description content relates to the changeset. Add a pull request description explaining the onboarding feature implementation, including key changes and motivation.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Onboarding in desktop2' directly describes the main changes in the PR, which involve implementing onboarding functionality across multiple desktop app files (Cargo.toml, commands.rs, ext.rs, lib.rs, store.rs, permissions.tsx, and onboarding/index.tsx).
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch onboarding-in-desktop2

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
apps/desktop/src-tauri/src/store.rs (1)

5-5: Consider clarifying the "2" suffix in the variant name.

The OnboardingNeeded2 name suggests versioning or migration from a previous implementation. If this is intentional for migration purposes, consider adding a comment explaining why. If not, a simpler name like OnboardingNeeded might be clearer.

apps/desktop/src-tauri/src/lib.rs (1)

117-137: Consider extracting the duplicated window logic.

The conditional window display logic is duplicated between the setup handler (Lines 117-126) and the Reopen event handler (Lines 131-137). Consider extracting this to a helper function to reduce duplication.

Example refactor:

fn handle_onboarding_windows(app: &AppHandle<tauri::Wry>) {
    if app.get_onboarding_needed().unwrap_or(true) {
        if let Err(e) = AppWindow::Main.hide(app) {
            tracing::error!("failed_to_hide_main_window: {:?}", e);
        }
        if let Err(e) = AppWindow::Onboarding.show(app) {
            tracing::error!("failed_to_show_onboarding_window: {:?}", e);
        }
    } else {
        if let Err(e) = AppWindow::Onboarding.destroy(app) {
            tracing::error!("failed_to_destroy_onboarding_window: {:?}", e);
        }
        if let Err(e) = AppWindow::Main.show(app) {
            tracing::error!("failed_to_show_main_window: {:?}", e);
        }
    }
}

Then call it from both locations:

// In setup
{
    let app_handle = app.handle().clone();
    handle_onboarding_windows(&app_handle);
}

// In run
if let tauri::RunEvent::Reopen { .. } = event {
    handle_onboarding_windows(&app);
}
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6135193 and ecb4143.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • apps/desktop/src/types/tauri.gen.ts is excluded by !**/*.gen.ts
📒 Files selected for processing (10)
  • apps/desktop/src-tauri/Cargo.toml (2 hunks)
  • apps/desktop/src-tauri/src/commands.rs (2 hunks)
  • apps/desktop/src-tauri/src/ext.rs (1 hunks)
  • apps/desktop/src-tauri/src/lib.rs (4 hunks)
  • apps/desktop/src-tauri/src/store.rs (1 hunks)
  • apps/desktop/src/components/onboarding/permissions.tsx (0 hunks)
  • apps/desktop/src/routes/app/onboarding/index.tsx (3 hunks)
  • crates/notification/src/lib.rs (0 hunks)
  • packages/utils/src/index.ts (0 hunks)
  • plugins/windows/src/ext.rs (2 hunks)
💤 Files with no reviewable changes (3)
  • apps/desktop/src/components/onboarding/permissions.tsx
  • crates/notification/src/lib.rs
  • packages/utils/src/index.ts
🧰 Additional context used
🧬 Code graph analysis (6)
plugins/windows/src/ext.rs (2)
plugins/windows/src/events.rs (1)
  • app (32-32)
plugins/windows/src/overlay.rs (1)
  • app (37-37)
apps/desktop/src-tauri/src/commands.rs (1)
apps/desktop/src-tauri/src/ext.rs (4)
  • get_onboarding_needed (6-6)
  • get_onboarding_needed (17-23)
  • set_onboarding_needed (7-7)
  • set_onboarding_needed (26-31)
apps/desktop/src-tauri/src/store.rs (1)
plugins/auth/js/bindings.gen.ts (1)
  • StoreKey (54-54)
apps/desktop/src-tauri/src/lib.rs (2)
apps/desktop/src-tauri/src/commands.rs (2)
  • get_onboarding_needed (47-51)
  • set_onboarding_needed (55-60)
apps/desktop/src-tauri/src/ext.rs (4)
  • get_onboarding_needed (6-6)
  • get_onboarding_needed (17-23)
  • set_onboarding_needed (7-7)
  • set_onboarding_needed (26-31)
apps/desktop/src-tauri/src/ext.rs (2)
apps/desktop/src-tauri/src/commands.rs (2)
  • get_onboarding_needed (47-51)
  • set_onboarding_needed (55-60)
plugins/store2/src/ext.rs (2)
  • store (6-6)
  • store (14-18)
apps/desktop/src/routes/app/onboarding/index.tsx (2)
apps/desktop/src/types/tauri.gen.ts (1)
  • commands (9-34)
plugins/windows/js/bindings.gen.ts (1)
  • commands (9-66)
⏰ 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). (1)
  • GitHub Check: ci (macos, macos-14)
🔇 Additional comments (6)
apps/desktop/src-tauri/Cargo.toml (1)

46-46: LGTM!

The new dependencies are correctly specified for the onboarding state management feature.

Also applies to: 60-60

apps/desktop/src/routes/app/onboarding/index.tsx (1)

66-73: LGTM!

The onboarding completion flow correctly persists state before transitioning to the main window.

apps/desktop/src-tauri/src/commands.rs (1)

45-60: LGTM!

The commands provide a clean interface for frontend access to onboarding state.

plugins/windows/src/ext.rs (1)

48-48: LGTM!

Making hide and destroy public enables the conditional window display logic in the onboarding flow.

Also applies to: 64-64

apps/desktop/src-tauri/src/lib.rs (1)

2-6: LGTM!

The module structure and plugin integration are correctly implemented.

Also applies to: 71-71, 146-147

apps/desktop/src-tauri/src/ext.rs (1)

1-32: LGTM!

The AppExt trait provides a clean, well-structured interface for onboarding state management. The default value of true for get_onboarding_needed correctly handles first-time users, and the tracing instrumentation aids debugging.

@yujonglee yujonglee merged commit 6533c98 into main Nov 7, 2025
12 of 13 checks passed
@yujonglee yujonglee deleted the onboarding-in-desktop2 branch November 7, 2025 11:00
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.

2 participants