fix(cmd-k): when navigating to current workspace/workflow, close modal instead of navigating (#2420)

* fix(cmd-k): when navigating to current workspace, close modal instead of navigating

* ack PR comment
This commit is contained in:
Waleed
2025-12-17 10:21:35 -08:00
committed by GitHub
parent f4f74da1dc
commit 08bc1125bd

View File

@@ -423,7 +423,21 @@ export function SearchModal({
}
break
case 'workspace':
if (item.isCurrent) {
break
}
if (item.href) {
router.push(item.href)
}
break
case 'workflow':
if (!item.isCurrent && item.href) {
router.push(item.href)
window.dispatchEvent(
new CustomEvent(SIDEBAR_SCROLL_EVENT, { detail: { itemId: item.id } })
)
}
break
case 'page':
case 'doc':
if (item.href) {
@@ -431,12 +445,6 @@ export function SearchModal({
window.open(item.href, '_blank', 'noopener,noreferrer')
} else {
router.push(item.href)
// Scroll to the workflow in the sidebar after navigation
if (item.type === 'workflow') {
window.dispatchEvent(
new CustomEvent(SIDEBAR_SCROLL_EVENT, { detail: { itemId: item.id } })
)
}
}
}
break