chore(code): add tooltip to branch selector#1937
Merged
VojtechBartos merged 1 commit intomainfrom Apr 29, 2026
Merged
Conversation
Prompt To Fix All With AIThis is a comment left during a code review.
Path: apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx
Line: 179-190
Comment:
**Stale `hovered` state when button becomes disabled**
When the button transitions to `disabled` while the cursor is already over it, `onMouseLeave` may not fire (disabled elements don't reliably receive pointer events in browsers), leaving `hovered` stuck as `true`. Once loading finishes — flipping `effectiveLoading` to `false` — the condition `hovered && !open && !effectiveLoading` becomes truthy even though the cursor has since moved away, causing the tooltip to appear unexpectedly.
Resetting `hovered` whenever `isDisabled` flips to `true` would guard against this:
```tsx
useEffect(() => {
if (isDisabled) setHovered(false);
}, [isDisabled]);
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "chore(code): add tooltip to branch selec..." | Re-trigger Greptile |
Comment on lines
+179
to
+190
| open={hovered && !open && !effectiveLoading} | ||
| > | ||
| <ComboboxTrigger | ||
| render={ | ||
| <Button | ||
| ref={localAnchorRef} | ||
| variant="outline" | ||
| size="sm" | ||
| disabled={isDisabled} | ||
| aria-label="Branch" | ||
| onMouseEnter={() => setHovered(true)} | ||
| onMouseLeave={() => setHovered(false)} |
There was a problem hiding this comment.
Stale
hovered state when button becomes disabled
When the button transitions to disabled while the cursor is already over it, onMouseLeave may not fire (disabled elements don't reliably receive pointer events in browsers), leaving hovered stuck as true. Once loading finishes — flipping effectiveLoading to false — the condition hovered && !open && !effectiveLoading becomes truthy even though the cursor has since moved away, causing the tooltip to appear unexpectedly.
Resetting hovered whenever isDisabled flips to true would guard against this:
useEffect(() => {
if (isDisabled) setHovered(false);
}, [isDisabled]);Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx
Line: 179-190
Comment:
**Stale `hovered` state when button becomes disabled**
When the button transitions to `disabled` while the cursor is already over it, `onMouseLeave` may not fire (disabled elements don't reliably receive pointer events in browsers), leaving `hovered` stuck as `true`. Once loading finishes — flipping `effectiveLoading` to `false` — the condition `hovered && !open && !effectiveLoading` becomes truthy even though the cursor has since moved away, causing the tooltip to appear unexpectedly.
Resetting `hovered` whenever `isDisabled` flips to `true` would guard against this:
```tsx
useEffect(() => {
if (isDisabled) setHovered(false);
}, [isDisabled]);
```
How can I resolve this? If you propose a fix, please make it concise.
jonathanlab
approved these changes
Apr 29, 2026
Replace the native title attribute on the branch selector button with the styled Tooltip component so it matches the rest of the top-bar UI. Tooltip opens on mouse hover only and is suppressed while the dropdown is open or loading. Generated-By: PostHog Code Task-Id: b6750e3b-b69f-48a6-bc2d-124ba5642eb9
48b1c2f to
9f71eb1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the native
titleattribute on the top-bar branch selector button with the styledTooltipcomponent already used elsewhere in the app (e.g.DiffStatsBadge,ReviewToolbar). Applies to bothHeaderRowandTaskInputusages ofBranchSelector.The tooltip opens on mouse hover only — focus no longer triggers it, so it doesn't pop back up after the combobox is dismissed. It's also suppressed while the dropdown is open or while loading.
Shocase
Created with PostHog Code