Skip to content

Search people fix#1195

Merged
yujonglee merged 4 commits intomainfrom
search-people-fix
Jul 22, 2025
Merged

Search people fix#1195
yujonglee merged 4 commits intomainfrom
search-people-fix

Conversation

@duckduckhero
Copy link
Contributor

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 22, 2025

📝 Walkthrough

Walkthrough

The changes introduce a new asynchronous helper and a modular React component to improve session search result rendering in the CommandPalette. The backend session search query is expanded to include participant names and emails, with corresponding UI logic to display participant snippets when content matches are not found.

Changes

File(s) Change Summary
apps/desktop/src/components/command-palette.tsx Added extractParticipantSnippet async helper and SessionItem component; refactored session result rendering to use new component and participant snippet fallback.
crates/db-user/src/sessions_ops.rs Expanded SQL query in session search to match participant full names and emails; adjusted joins and parameters.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CommandPalette
    participant SessionItem
    participant Backend

    User->>CommandPalette: Search with query
    CommandPalette->>Backend: list_sessions(query)
    Backend-->>CommandPalette: Session search results (including participant info)
    CommandPalette->>SessionItem: Render each session match
    alt No content snippet found
        SessionItem->>Backend: extractParticipantSnippet(sessionId, query)
        Backend-->>SessionItem: Participant snippet
    end
    SessionItem-->>User: Display session title, date, and snippet (content or participant)
Loading

Estimated code review effort

3 (~45 minutes)

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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: 1

🧹 Nitpick comments (1)
crates/db-user/src/sessions_ops.rs (1)

124-151: Consider adding database indexes for participant search performance.

The addition of LEFT JOINs and participant-based search will work correctly, but may impact query performance on larger datasets. The DISTINCT operation also adds overhead.

Consider adding the following indexes to optimize this query:

  • Index on session_participants.session_id
  • Index on session_participants.human_id
  • Index on humans.full_name
  • Index on humans.email

These indexes will significantly improve the performance of the JOIN operations and the LIKE searches on participant data.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c412cd5 and b30b5f3.

📒 Files selected for processing (2)
  • apps/desktop/src/components/command-palette.tsx (2 hunks)
  • crates/db-user/src/sessions_ops.rs (1 hunks)
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

⚙️ CodeRabbit Configuration File

**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

Files:

  • crates/db-user/src/sessions_ops.rs
  • apps/desktop/src/components/command-palette.tsx
🪛 Biome (1.9.4)
apps/desktop/src/components/command-palette.tsx

[error] 96-96: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 97-97: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

⚙️ CodeRabbit Configuration File

**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

Files:

  • crates/db-user/src/sessions_ops.rs
  • apps/desktop/src/components/command-palette.tsx
🪛 Biome (1.9.4)
apps/desktop/src/components/command-palette.tsx

[error] 96-96: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 97-97: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (1)
apps/desktop/src/components/command-palette.tsx (1)

92-117: Add error handling and use optional chaining.

The function lacks proper error handling and could benefit from optional chaining as suggested by static analysis.

Apply this diff to improve error handling and use optional chaining:

 const extractParticipantSnippet = async (sessionId: string, query: string) => {
   try {
     const participants = await dbCommands.sessionListParticipants(sessionId);
     const matchingParticipants = participants.filter(p =>
-      (p.full_name && p.full_name.toLowerCase().includes(query.toLowerCase()))
-      || (p.email && p.email.toLowerCase().includes(query.toLowerCase()))
+      p.full_name?.toLowerCase().includes(query.toLowerCase())
+      || p.email?.toLowerCase().includes(query.toLowerCase())
     );
 
     if (matchingParticipants.length > 0) {
       const names = matchingParticipants
         .map(p => p.full_name || p.email)
         .filter(Boolean)
         .slice(0, 3); // Limit to 3 names
 
       const nameText = names.join(", ");
       const extraCount = matchingParticipants.length - names.length;
 
       return extraCount > 0
         ? `Meeting with ${nameText} and ${extraCount} other${extraCount > 1 ? "s" : ""}`
         : `Meeting with ${nameText}`;
     }
   } catch (error) {
-    console.error("Error fetching participants:", error);
+    // Silently fail and return null - the UI will handle the missing snippet gracefully
   }
   return null;
 };

Likely an incorrect or invalid review comment.

@yujonglee yujonglee merged commit 3d9ae83 into main Jul 22, 2025
8 checks passed
@yujonglee yujonglee deleted the search-people-fix branch July 22, 2025 19:51
@coderabbitai coderabbitai bot mentioned this pull request Oct 10, 2025
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