Skip to content

Commit 6c9d989

Browse files
committed
fix: keep checkpoint menu visible when popover is open
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
1 parent 6c2aa63 commit 6c9d989

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

webview-ui/src/components/chat/checkpoints/CheckpointMenu.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ type CheckpointMenuProps = {
1313
commitHash: string
1414
currentHash?: string
1515
checkpoint: Checkpoint
16+
onPopoverOpenChange?: (open: boolean) => void
1617
}
1718

18-
export const CheckpointMenu = ({ ts, commitHash, currentHash, checkpoint }: CheckpointMenuProps) => {
19+
export const CheckpointMenu = ({
20+
ts,
21+
commitHash,
22+
currentHash,
23+
checkpoint,
24+
onPopoverOpenChange,
25+
}: CheckpointMenuProps) => {
1926
const { t } = useTranslation()
2027
const [isOpen, setIsOpen] = useState(false)
2128
const [isConfirming, setIsConfirming] = useState(false)
@@ -54,6 +61,7 @@ export const CheckpointMenu = ({ ts, commitHash, currentHash, checkpoint }: Chec
5461
onOpenChange={(open) => {
5562
setIsOpen(open)
5663
setIsConfirming(false)
64+
onPopoverOpenChange?.(open)
5765
}}>
5866
<StandardTooltip content={t("chat:checkpoint.menu.restore")}>
5967
<PopoverTrigger asChild>

webview-ui/src/components/chat/checkpoints/CheckpointSaved.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useMemo } from "react"
1+
import { useMemo, useState } from "react"
22
import { useTranslation } from "react-i18next"
33

44
import { CheckpointMenu } from "./CheckpointMenu"
@@ -15,6 +15,7 @@ type CheckpointSavedProps = {
1515
export const CheckpointSaved = ({ checkpoint, ...props }: CheckpointSavedProps) => {
1616
const { t } = useTranslation()
1717
const isCurrent = props.currentHash === props.commitHash
18+
const [isPopoverOpen, setIsPopoverOpen] = useState(false)
1819

1920
const metadata = useMemo(() => {
2021
if (!checkpoint) {
@@ -48,8 +49,8 @@ export const CheckpointSaved = ({ checkpoint, ...props }: CheckpointSavedProps)
4849
"linear-gradient(90deg, rgba(0, 188, 255, .65), rgba(0, 188, 255, .65) 80%, rgba(0, 188, 255, 0) 99%)",
4950
}}></span>
5051

51-
<div className="hidden group-hover:block h-4 -mt-2">
52-
<CheckpointMenu {...props} checkpoint={metadata} />
52+
<div className={`h-4 -mt-2 ${isPopoverOpen ? "block" : "hidden group-hover:block"}`}>
53+
<CheckpointMenu {...props} checkpoint={metadata} onPopoverOpenChange={setIsPopoverOpen} />
5354
</div>
5455
</div>
5556
)

0 commit comments

Comments
 (0)