mirror of
https://github.com/stablyai/orca.git
synced 2026-09-28 08:02:43 +00:00
fix: guard work item link copy feedback (#3509)
This commit is contained in:
@@ -5440,6 +5440,16 @@ export default function GitHubItemDialog({
|
||||
const files = details?.files ?? []
|
||||
const checks = details?.checks ?? []
|
||||
const [pendingViewedPaths, setPendingViewedPaths] = useState<Set<string>>(() => new Set())
|
||||
// Why: clipboard IPC can resolve after the dialog unmounts; skip copied-state
|
||||
// feedback instead of starting its reset timer on a stale surface.
|
||||
const linkCopyMountedRef = useRef(false)
|
||||
|
||||
useEffect(() => {
|
||||
linkCopyMountedRef.current = true
|
||||
return () => {
|
||||
linkCopyMountedRef.current = false
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
setLinkCopied(false)
|
||||
@@ -5461,6 +5471,9 @@ export default function GitHubItemDialog({
|
||||
// Why: Electron's clipboard IPC is reliable even when browser clipboard
|
||||
// APIs lose focus/activation inside nested overlay surfaces.
|
||||
await window.api.ui.writeClipboardText(workItem.url)
|
||||
if (!linkCopyMountedRef.current) {
|
||||
return
|
||||
}
|
||||
setLinkCopied(true)
|
||||
toast.success('GitHub link copied')
|
||||
} catch {
|
||||
|
||||
@@ -5325,6 +5325,16 @@ export default function PullRequestPage({
|
||||
const files = details?.files ?? []
|
||||
const checks = details?.checks ?? []
|
||||
const [pendingViewedPaths, setPendingViewedPaths] = useState<Set<string>>(() => new Set())
|
||||
// Why: clipboard IPC can resolve after the page unmounts; skip copied-state
|
||||
// feedback instead of starting its reset timer on a stale surface.
|
||||
const linkCopyMountedRef = useRef(false)
|
||||
|
||||
useEffect(() => {
|
||||
linkCopyMountedRef.current = true
|
||||
return () => {
|
||||
linkCopyMountedRef.current = false
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
setLinkCopied(false)
|
||||
@@ -5346,6 +5356,9 @@ export default function PullRequestPage({
|
||||
// Why: Electron's clipboard IPC is reliable even when browser clipboard
|
||||
// APIs lose focus/activation inside nested overlay surfaces.
|
||||
await window.api.ui.writeClipboardText(workItem.url)
|
||||
if (!linkCopyMountedRef.current) {
|
||||
return
|
||||
}
|
||||
setLinkCopied(true)
|
||||
toast.success('GitHub link copied')
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user