Skip to content

Comments

Chore: search code splitting#6628

Merged
sriramveeraghanta merged 8 commits intopreviewfrom
chore-search-code-splittign
Feb 18, 2025
Merged

Chore: search code splitting#6628
sriramveeraghanta merged 8 commits intopreviewfrom
chore-search-code-splittign

Conversation

@gakshita
Copy link
Collaborator

@gakshita gakshita commented Feb 18, 2025

Description

This PR does the code splitting for sidebar search

Summary by CodeRabbit

  • New Features

    • Introduced a dedicated search component in the sidebar that provides quick access to the command palette.
    • Added new export capabilities for the sidebar module, enhancing component accessibility.
  • Refactor

    • Replaced the previous search action with an enhanced, unified interface for a more streamlined workspace experience.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2025

Warning

Rate limit exceeded

@gakshita has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 41 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ccea695 and 6549196.

📒 Files selected for processing (4)
  • web/ce/components/workspace/sidebar/index.ts (1 hunks)
  • web/core/components/home/widgets/links/use-links.tsx (1 hunks)
  • web/core/components/workspace/sidebar/quick-actions.tsx (4 hunks)
  • web/ee/components/workspace/index.ts (1 hunks)

Walkthrough

The changes add a new React component, AppSearch, to the sidebar in the workspace. The component, wrapped with MobX’s observer and utilizing hooks, is responsible for triggering the command palette modal on button click. In addition, export statements have been updated in both CE and EE modules, and the existing SidebarQuickActions component now renders the new AppSearch component in place of its direct command palette control.

Changes

File(s) Change Summary
web/ce/.../workspace/index.ts Added export for the ./sidebar module.
web/ce/.../workspace/sidebar/index.ts Re-exported all exports from the app-search module.
web/ee/.../workspace/sidebar/{app-search.tsx, index.ts} Re-exported all functionalities from CE’s app-search module for EE usage.
web/ce/.../workspace/sidebar/app-search.tsx Introduced the new React functional component AppSearch with MobX observer and hooks (useAppTheme, useCommandPalette).
web/core/.../sidebar/quick-actions.tsx Removed the direct command palette button and associated destructuring; integrated <AppSearch /> instead.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AppSearch
    participant CommandPalette
    User->>AppSearch: Click search button
    AppSearch->>CommandPalette: toggleCommandPaletteModal(true)
    CommandPalette-->>User: Display command palette modal
Loading

Possibly related PRs

Suggested labels

🌐frontend, 🧹chore, 🛠️refactor

Suggested reviewers

  • sriramveeraghanta
  • SatishGandham

Poem

Oh, I’m a rabbit in the codeland today,
Hoping through files in a curious way.
With a tap of a button, search comes to life,
Replacing old code and easing some strife.
A little bounce of joy for UI so bright –
Celebrating changes with a coding delight!
🐰✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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: 0

🧹 Nitpick comments (2)
web/ce/components/workspace/sidebar/app-search.tsx (2)

14-24: Enhance button accessibility.

The search button should include proper ARIA attributes for better accessibility.

 <button
   className={cn(
     "flex-shrink-0 size-8 aspect-square grid place-items-center rounded hover:bg-custom-sidebar-background-90 outline-none",
     {
       "border-[0.5px] border-custom-sidebar-border-300": !sidebarCollapsed,
     }
   )}
   onClick={() => toggleCommandPaletteModal(true)}
+  aria-label="Open search"
+  role="button"
 >
   <Search className="size-4 text-custom-sidebar-text-300" />
 </button>

8-12: Consider adding keyboard shortcut support.

Adding keyboard shortcut support (e.g., Cmd/Ctrl + K) would improve user experience.

 export const AppSearch = observer(() => {
   // store hooks
   const { sidebarCollapsed } = useAppTheme();
   const { toggleCommandPaletteModal } = useCommandPalette();
+
+  useEffect(() => {
+    const handleKeyDown = (e: KeyboardEvent) => {
+      if ((e.metaKey || e.ctrlKey) && e.key === 'k') {
+        e.preventDefault();
+        toggleCommandPaletteModal(true);
+      }
+    };
+
+    document.addEventListener('keydown', handleKeyDown);
+    return () => document.removeEventListener('keydown', handleKeyDown);
+  }, [toggleCommandPaletteModal]);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cba27c3 and d383cc1.

📒 Files selected for processing (6)
  • web/ce/components/workspace/index.ts (1 hunks)
  • web/ce/components/workspace/sidebar/app-search.tsx (1 hunks)
  • web/ce/components/workspace/sidebar/index.ts (1 hunks)
  • web/core/components/workspace/sidebar/quick-actions.tsx (4 hunks)
  • web/ee/components/workspace/sidebar/app-search.tsx (1 hunks)
  • web/ee/components/workspace/sidebar/index.ts (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • web/ce/components/workspace/sidebar/index.ts
  • web/ee/components/workspace/sidebar/index.ts
  • web/ee/components/workspace/sidebar/app-search.tsx
🔇 Additional comments (3)
web/ce/components/workspace/index.ts (1)

6-6: LGTM! Export addition supports code splitting.

The new export for the sidebar module aligns with the code splitting strategy and maintains clean import paths.

web/ce/components/workspace/sidebar/app-search.tsx (1)

8-26: LGTM! Clean implementation of search component.

The component effectively implements the search functionality with proper state management and UI integration.

web/core/components/workspace/sidebar/quick-actions.tsx (1)

103-103: LGTM! Clean integration of AppSearch component.

The integration of AppSearch component effectively implements code splitting while maintaining the existing functionality.

@sriramveeraghanta sriramveeraghanta merged commit a49d899 into preview Feb 18, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore-search-code-splittign branch February 18, 2025 09:41
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* fix: Handled workspace switcher closing on click

* chore: code splitting for search

* fix: refactor

* fix: quick link error validation

* fix: refactor

* fix: refactor
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