Skip to content

feat(web): support Cmd+Click on new-session buttons to open in new tab#1288

Merged
YoungY620 merged 8 commits intomainfrom
feat/cmd-click-new-tab-create-session
Mar 2, 2026
Merged

feat(web): support Cmd+Click on new-session buttons to open in new tab#1288
YoungY620 merged 8 commits intomainfrom
feat/cmd-click-new-tab-create-session

Conversation

@YoungY620
Copy link
Copy Markdown
Collaborator

@YoungY620 YoungY620 commented Feb 28, 2026

Related Issue

N/A

Description

Support Cmd+Click (Mac) / Ctrl+Click (Windows/Linux) on all "+" new-session buttons to open the create-session flow in a new browser tab.

Changes:

  • web/src/App.tsx: Detect ?action=create and ?action=create-in-dir&workDir=xxx URL params on page load to auto-open the create dialog or directly create a session in the specified directory. Params are consumed after use to prevent re-triggering on refresh.
  • web/src/features/sessions/sessions.tsx: Top-level "+" button and grouped-view "New session here" button both support Cmd+Click to open a new tab. Tooltips updated with modifier-key hint.
  • web/src/features/chat/components/chat-conversation.tsx: Empty-state "Create new session" button supports Cmd+Click to open a new tab. Tooltip updated with modifier-key hint.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open with Devin

…ate session

Detect `?action=create` to open CreateSessionDialog and
`?action=create-in-dir&workDir=xxx` to directly create a session
in the specified directory. Params are consumed after use to prevent
re-triggering on refresh.

Entire-Checkpoint: c0496aeaab22
The top-level "+" button opens a new tab with `?action=create`.
The grouped-view "+" button opens a new tab with
`?action=create-in-dir&workDir=xxx`. Tooltips updated with
modifier-key hint.

Entire-Checkpoint: 92c17dd2c99c
Opens a new tab with `?action=create` when modifier key is held.
Tooltip updated with modifier-key hint.

Entire-Checkpoint: 5cb94db2865a
Copilot AI review requested due to automatic review settings February 28, 2026 05:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for Cmd+Click (Mac) / Ctrl+Click (Windows/Linux) on all "new session" + buttons to open the create-session flow in a new browser tab. It does so by constructing a URL with ?action=create or ?action=create-in-dir&workDir=xxx params and opening that URL via window.open(..., "_blank"). The receiving tab reads those params on mount in App.tsx, performs the appropriate action, and then cleans the params from the URL.

Changes:

  • App.tsx — Adds a useEffect that reads ?action=create / ?action=create-in-dir URL params on page load to auto-open the dialog or silently create a session, then removes the params.
  • sessions.tsx — Top-level + button and per-group "New session here" button both grow Cmd/Ctrl+Click handling and updated tooltips.
  • chat-conversation.tsx — Empty-state "Create new session" button gains the same Cmd/Ctrl+Click logic and tooltip update.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

File Description
web/src/App.tsx Adds URL-param–driven effect to auto-open dialog or create a session on page load
web/src/features/sessions/sessions.tsx Adds Cmd/Ctrl+Click handling + updated tooltips on two + buttons
web/src/features/chat/components/chat-conversation.tsx Adds Cmd/Ctrl+Click handling + updated tooltip on empty-state button

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

</KbdGroup>
</div>
<div className="flex items-center gap-2 text-xs text-muted-foreground">
<span>{newSessionShortcutModifier}+Click open in new tab</span>
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The tooltip text "{newSessionShortcutModifier}+Click open in new tab" is missing the word "to" — it should read "{newSessionShortcutModifier}+Click to open in new tab".

Suggested change
<span>{newSessionShortcutModifier}+Click open in new tab</span>
<span>{newSessionShortcutModifier}+Click to open in new tab</span>

Copilot uses AI. Check for mistakes.
Comment thread web/src/App.tsx
Comment on lines +119 to +133
if (action === "create") {
setShowCreateDialog(true);
} else if (action === "create-in-dir") {
const workDir = params.get("workDir");
if (workDir) {
createSession(workDir);
}
} else {
return;
}
params.delete("action");
params.delete("workDir");
const url = new URL(window.location.href);
url.search = params.toString();
window.history.replaceState({}, "", url.toString());
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

There are two related issues with the create-in-dir branch:

  1. Unhandled promise rejection: createSession(workDir) is called without await and without error handling. Since useEffect callbacks cannot be async, the promise rejection is silently swallowed. If the API call fails (e.g. network error, invalid directory), the user gets no feedback. The effect should use an inner async IIFE and wrap the call in try/catch to surface errors (e.g. via toast.error).

  2. Params consumed when no action is taken: When action === "create-in-dir" but workDir is null/empty (e.g. a manually crafted URL), createSession is never called, but the URL params are still removed (lines 129–133 run). The user receives no feedback and no retry is possible. A return should guard line 129 when workDir is missing, or an error should be displayed.

Copilot uses AI. Check for mistakes.
Comment thread web/src/features/sessions/sessions.tsx Outdated
</KbdGroup>
</div>
<div className="flex items-center gap-2 text-xs text-muted-foreground">
<span>{newSessionShortcutModifier}+Click open in new tab</span>
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The tooltip text "{newSessionShortcutModifier}+Click open in new tab" is missing a verb — it should read something like "{newSessionShortcutModifier}+Click to open in new tab". The same phrasing issue appears in all three tooltip locations in this PR: sessions.tsx lines 676 and 884, and chat-conversation.tsx line 167.

Suggested change
<span>{newSessionShortcutModifier}+Click open in new tab</span>
<span>{newSessionShortcutModifier}+Click to open in new tab</span>

Copilot uses AI. Check for mistakes.
Comment thread web/src/features/sessions/sessions.tsx Outdated
<TooltipContent side="right">New session here</TooltipContent>
<TooltipContent className="flex flex-col items-center gap-1" side="right">
<span>New session here</span>
<span className="text-xs text-muted-foreground">{newSessionShortcutModifier}+Click open in new tab</span>
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The tooltip text "{newSessionShortcutModifier}+Click open in new tab" is missing the word "to" — it should read "{newSessionShortcutModifier}+Click to open in new tab".

Suggested change
<span className="text-xs text-muted-foreground">{newSessionShortcutModifier}+Click open in new tab</span>
<span className="text-xs text-muted-foreground">{newSessionShortcutModifier}+Click to open in new tab</span>

Copilot uses AI. Check for mistakes.
devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 8 additional findings in Devin Review.

Open in Devin Review

Comment thread web/src/App.tsx
setShowCreateDialog(true);
} else if (action === "create-in-dir") {
const workDir = params.get("workDir");
if (!workDir) return; // invalid params, ignore silently
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 URL action params not cleaned up when create-in-dir is missing workDir

When the URL contains ?action=create-in-dir but no workDir parameter, the early return on line 123 skips the URL cleanup code (lines 130–134). The action parameter remains in the URL permanently.

Root Cause and Impact

The cleanup logic at web/src/App.tsx:130-134 only runs if the code doesn't hit an early return. The return on line 123 exits the effect before reaching the params.delete("action") call.

This means if a user navigates to ?action=create-in-dir (without workDir), the action param stays in the URL. On every page refresh, the effect re-runs, hits the same early return, and the stale param persists. While this is an edge case (the app always constructs URLs with workDir present at web/src/features/sessions/sessions.tsx:871-872), it violates the stated design goal of "Params are consumed after use to prevent re-triggering on refresh."

Suggested change
if (!workDir) return; // invalid params, ignore silently
if (!workDir) {
// Fall through to cleanup below
} else {
createSession(workDir).catch(() => {
// Errors are already handled globally via sessionsError → toast
});
}
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Signed-off-by: Young E <49367723+YoungY620@users.noreply.github.com>
@YoungY620 YoungY620 merged commit ce49cf6 into main Mar 2, 2026
14 checks passed
@YoungY620 YoungY620 deleted the feat/cmd-click-new-tab-create-session branch March 2, 2026 05:14
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