-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(web-shell): polish embedded shell interactions #7477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -570,6 +570,8 @@ export interface WebShellProps { | |
| renderToolHeaderExtra?: ToolHeaderExtraRenderer; | ||
| /** Custom renderer for the welcome header. Receives version, cwd, model, and mode. */ | ||
| renderWelcomeHeader?: WelcomeHeaderRenderer; | ||
| /** Show the worktree-isolation action in the empty welcome state. Defaults to false. */ | ||
| showWorktreeToggle?: boolean; | ||
| /** Custom renderer shown below the chat composer in the empty welcome state. */ | ||
| renderWelcomeFooter?: WelcomeFooterRenderer; | ||
| /** | ||
|
|
@@ -1058,6 +1060,7 @@ export function App({ | |
| composerTagIcons, | ||
| renderToolHeaderExtra, | ||
| renderWelcomeHeader, | ||
| showWorktreeToggle = false, | ||
| renderWelcomeFooter, | ||
| mobileWelcomeFooterMiddle = false, | ||
| parseUserMessageContent, | ||
|
|
@@ -6369,7 +6372,8 @@ export function App({ | |
| // session would land in is trusted and is a git repository — the daemon | ||
| // rejects worktree creation otherwise. Mirrors the sidebar entry's gating. | ||
| const worktreeToggleEligible = Boolean( | ||
| workspaces.find((entry) => entry.cwd === activeWorkspaceCwd)?.trusted && | ||
| showWorktreeToggle && | ||
| workspaces.find((entry) => entry.cwd === activeWorkspaceCwd)?.trusted && | ||
| selectedWorkspaceGitStatus?.branch, | ||
| ); | ||
| const worktreeToggleRef = useRef<HTMLButtonElement>(null); | ||
|
|
@@ -6385,6 +6389,11 @@ export function App({ | |
| setWorktreePending(false); | ||
| worktreeFocusTarget.current = 'toggle'; | ||
| }, []); | ||
| useEffect(() => { | ||
| if (showWorktreeToggle) return; | ||
| pendingWorktreeRef.current = undefined; | ||
| setWorktreePending(false); | ||
| }, [showWorktreeToggle]); | ||
|
Comment on lines
+6392
to
+6396
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The new Failure scenario: if a consumer initially renders with — qwen3.7-max via Qwen Code /review
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, this is a valid regression-test suggestion. The current implementation both gates the badge rendering on |
||
| useEffect(() => { | ||
| if (!worktreeFocusTarget.current) return; | ||
| const target = worktreeFocusTarget.current; | ||
|
|
@@ -6403,7 +6412,7 @@ export function App({ | |
| ) : ( | ||
| <WelcomeHeader {...welcomeHeaderProps} /> | ||
| )} | ||
| {worktreePending ? ( | ||
| {showWorktreeToggle && worktreePending ? ( | ||
| <div className={styles.worktreeWelcomeBadge}> | ||
| <span className={styles.worktreeBadgeIcon}> | ||
| <GitForkIcon size={18} strokeWidth={1.8} /> | ||
|
|
@@ -6454,6 +6463,7 @@ export function App({ | |
| ), | ||
| [ | ||
| renderWelcomeHeader, | ||
| showWorktreeToggle, | ||
| welcomeHeaderProps, | ||
| worktreePending, | ||
| worktreeToggleEligible, | ||
|
|
@@ -8032,6 +8042,7 @@ export function App({ | |
| error={artifactsError} | ||
| onSelectTab={setActiveArtifactPanelTabId} | ||
| onCloseTab={closeArtifactPanelTab} | ||
| onOpenFilePreview={openFilePreview} | ||
| onClose={closeArtifactPanel} | ||
| variant="drawer" | ||
| /> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Minor] No test locks in the new default-hidden behavior
All seven updated tests now pass
showWorktreeToggle: true, but the core contract this PR introduces — embedded consumers (prop absent/false) do not see the worktree action — has no assertion. A counterpart test would prevent the original leak from silently returning:(Also flagged by @yiliang114 in the overview.)
This review was generated by QoderWork AI