Skip to content

fix(desktop): prevent duplicate panes when file-open mode is new-tab#3115

Closed
AviPeltz wants to merge 2 commits into
mainfrom
ipriyankrajai/fix/tab-open
Closed

fix(desktop): prevent duplicate panes when file-open mode is new-tab#3115
AviPeltz wants to merge 2 commits into
mainfrom
ipriyankrajai/fix/tab-open

Conversation

@AviPeltz
Copy link
Copy Markdown
Collaborator

@AviPeltz AviPeltz commented Apr 2, 2026

Summary

Test plan

  • Verify file viewer panes are reused correctly across open modes
  • Confirm lint passes with bun run lint

Summary by cubic

Prevents duplicate file viewer panes when the file-open mode is set to “new-tab.” We now always find an already-open file first and only reuse it in-place when not opening in a new tab.

  • Bug Fixes
    • Decoupled reusable-pane lookup from openInNewTab, so existing file viewer panes are always found first.
    • Reuse the found pane only when openInNewTab is false and reuseExisting is not "none", avoiding duplicates across open modes.
    • Minor lint and import order cleanups; no behavior changes.

Written for commit 6c17549. Summary will update on new commits.

Summary by CodeRabbit

  • Refactor
    • Improved internal code organization through better import ordering across workspace components
    • Optimized pane reuse logic for enhanced condition handling
    • Simplified component implementations while maintaining existing functionality

Ipriyankrajai and others added 2 commits April 2, 2026 02:09
…n mode

Decouples the reuse-existing-pane lookup from the openInNewTab flag so
that an already-open file is always located first. The pane is still
only reused in-place when openInNewTab is false, preventing duplicate
panes when the user's file-open mode is set to "new-tab".
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4c267478-afcd-4a51-9f4f-b8cd39fbe670

📥 Commits

Reviewing files that changed from the base of the PR and between 9fa1c6b and 6c17549.

📒 Files selected for processing (5)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/usePaneRegistry.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/useV2WorkspacePaneLayout/useV2WorkspacePaneLayout.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/page.tsx
  • apps/desktop/src/renderer/routes/_authenticated/hooks/useDashboardSidebarState/useDashboardSidebarState.ts
  • apps/desktop/src/renderer/stores/tabs/store.ts

📝 Walkthrough

Walkthrough

Multiple files underwent import statement reordering and code formatting refinements. One file's logic was simplified by adjusting conditions for file-viewer pane reuse, removing an intermediate variable while maintaining behavioral equivalence through updated conditional gates.

Changes

Cohort / File(s) Summary
Pane Registry and Layout Hooks
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/usePaneRegistry.tsx, apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/useV2WorkspacePaneLayout/useV2WorkspacePaneLayout.ts
Reordered imports (type-only imports before value imports) and simplified TerminalPane JSX from multi-line wrapper to single-line direct return.
Dashboard Page Component
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/page.tsx
Reorganized imports, refactored mutation invocation to multi-line format, and simplified HotkeyTooltipContent JSX from multi-line to single-line usage.
Sidebar State Initialization
apps/desktop/src/renderer/routes/_authenticated/hooks/useDashboardSidebarState/useDashboardSidebarState.ts
Reformatted paneLayout object initialization from single-line to multi-line structure without changing fields or logic.
Tab Store Pane Reuse Logic
apps/desktop/src/renderer/stores/tabs/store.ts
Refined file-viewer pane reuse conditions by removing intermediate canReuseExistingPane variable and consolidating conditional logic into direct checks for reuseExisting !== "none" and !options.openInNewTab.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hops through imports, neat and clean,
Formats lines like never seen,
JSX shrinks from wide to small,
Logic flows—no change at all!
Panes reuse with better grace,
Rabbit code finds perfect place!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the main changes and rationale, but does not follow the repository's template structure with sections like 'Related Issues', 'Type of Change', 'Testing', and 'Additional Notes'. Restructure the description to match the repository template: add 'Related Issues' section, check appropriate 'Type of Change' boxes, complete the 'Testing' section with verification steps, and use 'Additional Notes' for any context.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(desktop): prevent duplicate panes when file-open mode is new-tab' accurately describes the main change in the changeset: decoupling pane reuse lookup from openInNewTab to prevent duplicates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ipriyankrajai/fix/tab-open

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
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

@Kitenite Kitenite closed this Apr 3, 2026
@Kitenite Kitenite deleted the ipriyankrajai/fix/tab-open branch May 6, 2026 04:54
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.

3 participants