Skip to content

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Sep 22, 2025

Description

This PR fixes the checkpoint restore popover positioning issue where the popover would misplace when the mouse moved from the CheckpointSaved component to the popover itself.

Problem

The CheckpointMenu was only visible on hover (using hidden group-hover:block). When users moved their mouse to interact with the popover, they would leave the hover area of the parent group, causing the CheckpointMenu to hide and the popover to lose its anchor element, resulting in incorrect positioning.

Solution

Added state tracking to maintain menu visibility when the popover is open:

  • Added isPopoverOpen state in CheckpointSaved component
  • Added onPopoverOpenChange callback prop to CheckpointMenu
  • Modified visibility logic to keep menu visible when popover is open

Changes

  • CheckpointSaved.tsx: Added state management for popover open status
  • CheckpointMenu.tsx: Added callback to notify parent when popover state changes

Testing

  • ✅ All existing tests pass
  • ✅ Linting and type checks pass
  • ✅ Manual testing confirms popover stays in correct position

Fixes #8219


Important

Fixes popover positioning in CheckpointSaved by managing menu visibility with new state and callback, ensuring correct interaction behavior.

  • Behavior:
    • Fixes popover positioning issue in CheckpointSaved by maintaining menu visibility when popover is open.
    • Introduces isPopoverOpen state and onPopoverOpenChange callback in CheckpointSaved.
    • Updates CheckpointMenu to handle controlled and uncontrolled popover states.
  • Testing:
    • Adds CheckpointSaved.spec.tsx to test popover visibility and confirm state reset.
    • Tests ensure menu visibility during popover interaction and correct state reset on close.
  • Misc:
    • Adjusts CheckpointMenu to use open and onOpenChange props for popover control.

This description was created by Ellipsis for 51059b9. You can customize this summary. It will automatically update as commits are pushed.

Fixes issue where the checkpoint restore popover would misposition when
the mouse moved from the CheckpointSaved component to the popover itself.
The menu now remains visible while the popover is open, preventing the
anchor element from disappearing.

Fixes #8219
@roomote roomote bot requested review from mrubens, cte and jr as code owners September 22, 2025 17:25
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working UI/UX UI/UX related or focused labels Sep 22, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 22, 2025
Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Reviewing my own code feels like debugging in a mirror - everything looks backwards but somehow still broken.

export const CheckpointSaved = ({ checkpoint, ...props }: CheckpointSavedProps) => {
const { t } = useTranslation()
const isCurrent = props.currentHash === props.commitHash
const [isPopoverOpen, setIsPopoverOpen] = useState(false)
Copy link
Author

Choose a reason for hiding this comment

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

Missing test coverage: Consider adding tests for this component, especially to verify the popover positioning fix and state management behavior. This would help prevent regression of the positioning bug.

onOpenChange={(open) => {
setIsOpen(open)
setIsConfirming(false)
onPopoverOpenChange?.(open)
Copy link
Author

Choose a reason for hiding this comment

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

Potential optimization: While the current implementation works well, consider memoizing the callback in the parent component if this component gets re-rendered frequently to avoid unnecessary re-renders.


<div className="hidden group-hover:block h-4 -mt-2">
<CheckpointMenu {...props} checkpoint={metadata} />
<div className={`h-4 -mt-2 ${isPopoverOpen ? "block" : "hidden group-hover:block"}`}>
Copy link
Author

Choose a reason for hiding this comment

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

Minor suggestion: For better semantic clarity, consider using a data attribute approach like instead of the ternary operator for class toggling. This would make the intent more explicit:

@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 23, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 23, 2025
@daniel-lxs daniel-lxs reopened this Sep 23, 2025
@github-project-automation github-project-automation bot moved this from Done to Triage in Roo Code Roadmap Sep 23, 2025
@github-project-automation github-project-automation bot moved this from Done to New in Roo Code Roadmap Sep 23, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Sep 23, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 23, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Sep 23, 2025
Copy link
Collaborator

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 23, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Sep 23, 2025
@mrubens mrubens merged commit 35791d0 into main Sep 23, 2025
15 checks passed
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Sep 23, 2025
@mrubens mrubens deleted the fix/checkpoint-popover-position-8219 branch September 23, 2025 22:35
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BUG] checkpoint restore position error
4 participants