refactor(web): the command palette's project items and pure helpers live in their own files#22699

merged1
refactor/command-palette-thread-items
refactor/command-palette-project-items
opened6d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 6d ago

CommandPalette.tsx is ~3,400 lines: one 2,600-line dialog component builds every item, runs every add-project flow, and renders the results. Layer 3 of a stack that splits it into focused files so each piece reads on its own and the React Compiler caches each piece on its own inputs.

Moves the project search and "New thread in..." item builders into CommandPaletteProjectItems.tsx, with one ProjectLocationDescription component replacing the two copies of the location + path markup. Pure helpers (browse platform, clone-flow types, remote-source readiness, input placeholder, error message, shortcut-to-overlay mapping) move to CommandPalette.logic.ts.

beforeafter
CommandPalette.tsx lines30552876
Renders, open palette + type 10 chars (median of 3)23522352

Measured with the fiber render counter, same browser session and seeded dev DB, swapping only the palette files between this layer and the one below it. Behavior is unchanged.

Tests: vp test run src/reactCompilerCoverage.test.ts -t CommandPalette (0 bailouts, new files included), vp test run src/components/CommandPalette.logic.test.ts, tsc --noEmit for apps/web, vp lint on changed files.

🤖 Generated with Claude Code

Checks

26 successful · 8 skipped
All checks passed
7e7936f

Added 1 commit

  • refactor(web): the command palette's project items and pure helpers live in their own files7e7936f
Synced from GitHub

Approvability

Verdict: Approved at 7e7936f

Macroscope's review found this PR approvable — This refactor extracts existing command-palette helpers and project-item rendering into focused files while preserving the existing item construction, search behavior, and callbacks. It does not alter product defaults or introduce new runtime capabilities.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Team
  • Run ID: ac71dd85-2d16-428e-a33e-e280d21c003c
📥 Commits

Reviewing files that changed from the base of the PR and between 0dd1a0aff8312a8fa4bf0467e2bb2eae5aa9b3e3 and 7e7936fe093e918a198bcd32dbe84a3fd45d118b.

📒 Files selected for processing: 3
  • apps/web/src/components/CommandPalette.logic.ts
  • apps/web/src/components/CommandPalette.tsx
  • apps/web/src/components/CommandPaletteProjectItems.tsx

Limit details: You’ve used all 10 included reviews currently available.

📝 Walkthrough

The command palette adds shared helpers for add-project flows and overlay commands. Dedicated builders now create project search and new-thread entries using project groups and environment locations.

Changes: Command Palette Project Actions

Layer / File(s)Summary
Shared palette helpers
apps/web/src/components/CommandPalette.logic.ts, apps/web/src/components/CommandPalette.tsx
Added environment platform mapping, add-project flow types and helpers, error formatting, and overlay lookup. CommandPalette.tsx imports these helpers instead of maintaining local implementations.
Project search and new-thread items
apps/web/src/components/CommandPaletteProjectItems.tsx, apps/web/src/components/CommandPalette.tsx
Added builders for project search and new-thread entries. The palette passes project groups, environment locations, and existing actions to the builders. Inline item construction and description rendering were removed.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: maria-rcks

Merge Risk: ⚪ Minimal · up to 7e793

The inspected project search behavior remains unchanged, and no concrete issue remains to block merging after normal checks.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title clearly describes the main refactor: moving command palette project items and pure helpers into separate files.
Description checkPassedThe description explains the problem, the refactoring changes, unchanged behavior, performance measurements, and verification commands. It does not include an explicit Scope and approval section or a …
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, the refactoring changes, unchanged behavior, performance measurements, and verification commands. It does not include an explicit Scope and approval section or a linked issue and approval rationale, but the core required information is present.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

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