Skip to content

fix(desktop): add tooltip to NewWorkspace modal new project button & make sure default selected - #461

Merged
AviPeltz merged 2 commits into
mainfrom
wet-loon-42124b
Dec 22, 2025
Merged

AviPeltz merged 2 commits into
mainfrom
wet-loon-42124b

Conversation

@AviPeltz

@AviPeltz AviPeltz commented Dec 22, 2025 •

Copy link
Copy Markdown
Collaborator

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

Release Notes

  • New Features

    • Added tooltip information for the Add New Project button for better clarity.
  • Bug Fixes

    • Fixed base branch selection to properly reset when switching between projects.
    • Corrected default branch indicators and selection visuals to accurately reflect the active base branch.
    • Improved base branch fallback behavior to use the project's default branch when appropriate.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 22, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The NewWorkspaceModal component was refactored to introduce an effectiveBaseBranch derived value that prioritizes explicit user selection with fallback to the default branch, while resetting the selection on project change. The Add New Project button is now wrapped in a Tooltip, and all branch references are updated to use the effective value.

Changes

Cohort / File(s) Summary
Modal Branch Selection Logic
apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
Added effectiveBaseBranch derived value with fallback to branchData.defaultBranch. Reset baseBranch to null on selectedProjectId change. Replaced all baseBranch usages with effectiveBaseBranch for display, selection, and defaults. Removed auto-selection effect. Updated workspace creation payloads and default-branch indicators. Added Tooltip wrapping for Add New Project button and imported Tooltip components.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • State management logic: New derived value pattern and effect cleanup require careful verification of fallback behavior and timing.
  • Systematic replacements: Multiple usages of effectiveBaseBranch across display, selection, and payload logic need cross-checking for consistency.
  • Project-switch behavior: Verify that resetting baseBranch on selectedProjectId change doesn't introduce unintended side effects.

Possibly related PRs

  • Add dropdown create modal #391: Directly modifies NewWorkspaceModal component and branch-handling behavior including branch selection and workspace creation payloads.

Poem

🐰 A branch springs forth, effective and true,
No longer leaving defaults askew—
With tooltips to guide and resets anew,
Each project remembers, as branches should do! 🌿

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description only contains the template structure with 'Bug fix' checked, but lacks actual details about the changes, related issues, testing, or additional context. Fill in the Description section with details about what was changed and why; add related issue links if applicable; describe testing performed and add any relevant screenshots or notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: adding a tooltip to the new project button and fixing default selection behavior.
✨ 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 wet-loon-42124b

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ab63cc and f77929e.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Avoid using any type in TypeScript - maintain type safety unless absolutely necessary

Files:

  • apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Run Biome for formatting, linting, import organization, and safe fixes at the root level using bun run lint:fix

Files:

  • apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
**/{components,features}/**/[!.]*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Organize project structure with one folder per component: ComponentName/ComponentName.tsx with index.ts barrel export

Files:

  • apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
**/{components,features}/**/*.{ts,tsx,test.ts,test.tsx,stories.tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Co-locate component dependencies (utils, hooks, constants, config, tests, stories) next to the file using them

Files:

  • apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never import Node.js modules in renderer process or shared code - use only in main process (src/main/)

Files:

  • apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
apps/desktop/src/{main,renderer,preload}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use type-safe IPC communication - define channel types in apps/desktop/src/shared/ipc-channels.ts before implementing handlers

Files:

  • apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
**/*.{tsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Use React + TailwindCSS v4 + shadcn/ui for UI development

Files:

  • apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
**/{components,features}/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

**/{components,features}/**/*.tsx: Nest components in parent's components/ folder if used only once, promote to highest shared parent's components/ if used 2+ times
Use one component per file - do not combine multiple components in a single file

Files:

  • apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx}: For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc
Use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary.
For tRPC subscriptions with trpc-electron, ALWAYS use the observable pattern from @trpc/server/observable instead of async generators, as the library explicitly checks isObservable(result) and throws an error otherwise

Files:

  • apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
🧠 Learnings (1)
📚 Learning: 2025-12-18T23:19:10.415Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-18T23:19:10.415Z
Learning: Applies to **/*.{tsx,css} : Use React + TailwindCSS v4 + shadcn/ui for UI development

Applied to files:

  • apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx
🧬 Code graph analysis (1)
apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx (2)
packages/ui/src/components/ui/tooltip.tsx (3)
  • Tooltip (76-76)
  • TooltipTrigger (76-76)
  • TooltipContent (76-76)
packages/ui/src/components/ui/button.tsx (1)
  • Button (60-60)
⏰ 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: Build
🔇 Additional comments (4)
apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx (4)

105-112: LGTM! Clean implementation of default branch fallback.

The effectiveBaseBranch derived value elegantly ensures a default branch is always selected by falling back to branchData?.defaultBranch when no explicit selection exists. Resetting baseBranch on project change prevents stale selections across different projects. This approach is cleaner than auto-setting state in an effect.


221-236: LGTM! Tooltip implementation follows best practices.

The tooltip correctly wraps the "Add new project" button using shadcn/ui patterns. The asChild prop on TooltipTrigger properly delegates rendering to the Button, and the tooltip text is clear and concise. The positioning (side="bottom", sideOffset={4}) provides good UX.


152-152: LGTM! Correctly uses effectiveBaseBranch in creation payload.

The workspace creation now sends effectiveBaseBranch instead of baseBranch, ensuring the default branch is used when no explicit selection exists. The || undefined fallback appropriately handles the null case.


336-343: LGTM! Consistent effectiveBaseBranch usage across UI.

All display and selection logic correctly uses effectiveBaseBranch:

  • Line 336: Shows the effective branch name in the trigger button
  • Lines 338-339: "default" badge appears when the effective branch is the default
  • Line 391: Checkmark indicates the currently effective selection

This creates clear UX where users always see which branch will be used, even when relying on the fallback default.

Also applies to: 391-393


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.

@AviPeltz
AviPeltz marked this pull request as ready for review December 22, 2025 01:27
@AviPeltz
AviPeltz merged commit 409676d into main Dec 22, 2025
5 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

Service Status
Neon Database (Neon) ✅

Thank you for your contribution! 🎉


Preview resources have been processed for cleanup

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.

1 participant